c# - WPF: Validate TextBox content immediately -


this question has answer here:

is there way in wpf/xaml indicate validation should performed (after each character entered in textbox) instead of when focus lost?

you should detect event "keyup" or "keydown" , check if input correct.

private void textbox_keyup(object sender, keyroutedeventargs e) {             if (e.key == yourkey)     {         //do     } } 

Comments