MaskTextBox and Paste - Spaces, tabs & V?

Editors for WPF Forum

Posted 8 years ago by David Rose
Version: 11.1.0532
Avatar
I'm attempting to paste into a MaskedTextBox with the following mask="( [A-Z])?[0-9]{6,10}".

If the paste is a number or a number with a A-Z, it works fine, but if it has whitespace of more than one letter in front of the letter, it does not paste.

I attempted to intercept the space on the PreviewKeyUp event (set e.handled=true for space or tab), but I seem to be getting the V (from CTRL-V) instead of the pasted text.

Thanks!

Comments (1)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi David,

The only chance you have to change the clipboard contents would be to create a custom class that derives from MaskedTextBox and override OnExecutedCommand. If the e.Command is ApplicationCommands.Paste, then you'd need to update the clipboard and then call the base method.


Actipro Software Support

The latest build of this product (v2019.1 build 0681) was released 19 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.