I have created a custom control inheriting TextBox
. This custom control is a numeric TextBox
, only supporting numbers.
I am using OnPreviewTextInput
to check each new character being typed to see if the character is a valid input. This works great. However, if I paste the text into the TextBox
, OnPreviewTextInput
is not fired.
What is the best way to capture pasted text in a TextBox
?
Also, I have a problem when the back space is pressed, I can't figure out what event this will fire. OnPreviewTextInput
is not fired!
Any ideas how to capture pasted text and back space events in WPF TextBox
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…