In our WPF application, we were wondering why our CTRL-Backslash
keyboard shortcut wasn't firing. Wrote a quick test app to log what key was being pressed, and in the OnKeyDown
override, e.Key
was being reported as OemQuote
and not OemBackslash
as expected.
Worse, on someone else's machine (but also with a US keyboard and the US layout too, but a different manufacturer), they get a different value for e.Key
altogether.
Yes, I know that's what 'Oem' stands for, but shouldn't all OEMs know what the heck a backslash is and treat it consistently?!
If not, which is the case, how are you supposed to be able to assign Backslash
to a keyboard shortcut for different machines?
Now I know the OS knows it's a backslash because on both machines, the correct value is typed into a textbox, so obviously the OS (through the driver I'm assuming) knows what to map it to, but I can't believe that I can't create a shortcut based on the backslash and expect it to work reliably on different machines and configurations.