Paste Event in a WPF TextBox

Posted by code-zoop on Stack Overflow See other posts from Stack Overflow or by code-zoop
Published on 2010-06-17T12:08:36Z Indexed on 2010/06/17 12:13 UTC
Read the original article Hit count: 1530

Filed under:
|
|

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?

Thanks

© Stack Overflow or respective owner

Related posts about wpf

Related posts about events