I’m quite confused about handling of Key http://msdn.microsoft.com/en-us/library/system.windows.input.key.aspx in a KeyEventArgs.
For example: I want to handle colon key (made on my Italian keyboard with dot + Shift), so I write some code like this
if ( e.Key == Key.OemPeriod && e.KeyboardDevice.Modifiers == ModifierKeys.Shift) {
// Code
}
But this approach isn’t correct because work only with Italian keyboard. What is the correct and culture independent way to handle Key in WPF?
Have you tried handling the PreviewTextInput or TextInput events instead? These events should give you the text entered (which is device-independent) as opposed to the physical key pressed (which is device-dependent).