I have a WPF textbox, and perform the following actions
- Enter text as “12345”
- Move cursor between 3 and 4 (using arrow or
mouseclick) - Enter 0 (so Text is now “123045”)
Which event/eventargs can tell me that 0 was typed at location 4.
I need to know this at Preview level so that I can reject the character 0 based on the prefixed and suffixed digits.
In PreviewTextInput event you can use the TextBox’s CaretIndex property to know the location where input is being typed.