0

I've created a OnKeyUp method to RichTextControl, and I want to ignore all keys, which are special characters (like shift, control, alt etc).

One way to do that is to enumerate all the characters that I want to ignore, but I'm wondering, if there's something like IsSpecialKey function somewhere, that I can use in this context

Arsen Zahray
  • 24,367
  • 48
  • 131
  • 224
  • Possible duplicate http://stackoverflow.com/questions/813389/how-to-capture-ctrltab-ctrlshifttab-in-wpf – Lukasz Madon Apr 18 '12 at 21:39
  • I don't want to capchure a key. I want to check if my key belongs to array of special keys, like shift, alt win etc. Those aren't exactly the same – Arsen Zahray Apr 18 '12 at 21:42

1 Answers1

1

I think you can use the Char.IsControl method on the KeyCode property of the KeyEventArgs like this:

KeysConverter kc = new KeysConverter();
if (!Char.IsControl(Convert.ToChar(kc.ConvertToString(e.KeyCode))))
{
    ...
}
david.s
  • 11,283
  • 6
  • 50
  • 82