The change event of the text in the TextInput

The question was asked: 6 years 9 months ago   views: 7
0

Probably not understand this event, but it will be called every time we enter in a textBox? Did so and no response. Tell me how to make plans?

private void Password_TextInput(object sender, TextCompositionEventArgs e)
{
 if (Login.Text != "admin" && Password.Password != "123456")
{
 Information.Content = "Invalid username or password!";
}
}

Event fastened at all 2 textboxa, if that.

Asked: angry angry 21-06-2012 в 14:17:35

Answers   1

0

ContentElement.TextInput Event

The TextInput event may already be marked as handled by 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 this because the control needs to interpret some types of input, such as arrow keys, as having special meaning to that control. If you use PreviewTextInput as the event where you attach handlers for text input, you may receive better results. This technique circumvents most cases where control composition has already marked this event as handled and prevents your handler from receiving the event along the event route.

It would be better to use the event TextBoxBase.TextChangedor ContentElement.PreviewTextInput.

UPD. Did not pay attention that you use the PasswordBox. For this control, you must use the event of the PasswordBox.PasswordChanged. No TextInput event and TextChanged, probably related to security.

Answered: Ilya Pirogov Ilya Pirogov 21-06-2012 в 14:30:34
For a login that works without problems, and for the component Password is not. And I can not find how to force... - johniek_comp johniek_comp 21-06-2012 в 14:36:52