MaskTextBox and Paste - Spaces, tabs & V?

Editors for WPF Forum

Posted 13 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 13 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 (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.