WPF, PreviewKeyDown event and underscore char
- by commanderz
Hi,
I'm catching key hits with PreviewKeyDown event in my WPF component. I need to distinguish characters being typed: letters vs. numbers vs. underscore vs. anything else.
Letters and numbers work fine (just convert the Key property of the KeyEventArgs object to string and work with character 0 of that string), but this won't work for underscore.
It's ToString value depends on localized keyboard settings (it shows up as "OemMinus" on EN/US keyboard and "OemQuestion" on CZ/QWERTY keyboard).
So how can I RELIABLY find out, if the typed char is underscore in the PreviewKeyDown event?
Thanks for any help