Probably not so understood this event, but it will be called every time we enter something in the textBox? Did so and no reaction. Tell me how to make your plans?

private void Password_TextInput(object sender, TextCompositionEventArgs e) { if (Login.Text != "admin" && Password.Password != "123456") { Information.Content = "Неверный логин или пароль!"; } } 

The event is bolted to all 2 textboxa, if that.

    1 answer 1

    ContentElement.TextInput Event

    Event can be used as a guide for the internal implementations of composited controls. For example, a TextBox is a composited control where the TextInput event is already marked as handled ; within its compositing. Controls do not need this type of input, such as control keys. If you use the PreviewTextInput text, you can get better results. This is a technique of the most recent scenarios along the event route.

    It would be more correct to use the TextBoxBase.TextChanged event, or ContentElement.PreviewTextInput .

    UPD. Did not pay attention that PasswordBox used. For this control, you must use the PasswordBox.PasswordChanged event. The lack of generation of TextInput and TextChanged events is apparently related to security.

    • For login it works, no problem, but for the Password component it does not. And I will not find how to make ... - johniek_comp