[ACCEPTED]-WPF: Textbox not firing onTextInput event-textinput

Accepted answer
Score: 16

Your handler for the TextInput event is not fired 4 because the TextBox is handling the event. You 3 could try using the TextChanged event instead, since 2 really you just want to know when characters 1 were added or removed from the TextBox.

Score: 8
InitializeComponent();
textbox.AddHandler(TextBox.TextInputEvent, 
                   new TextCompositionEventHandler(TextBox_TextInput_1), 
                   true);

0

Score: 1

Use "PreviewTextInput" instead, it will 1 work.

Score: 0

Create a new class derived from TextBox. In 3 the new class override the OnTextInput method. Your 2 OnTextInput method will get called before 1 the TextBox gets it.

More Related questions