How to supress the Alt-Key in Silverlight’s TextBox

How to supress the Alt-Key in Silverlight’s TextBox

You can restrict the input-values in Silverlight’s TextBox by handling the KeyDown-Event. But the KeyDown-Event isn’t fired if the user enters a key by pressing e.g. ALT + 123.

Corresponding to the problem mentioned in http://forums.silverlight.net/forums/t/147718.aspx, I’ll show here a short workaround by using the TextChanged and KeyUp-Event of the TextBox. Just use the following snippet, that removes a character that was added by pressing the ALT- and another Key or Key-Combination:

Share this post