Harry Harry - 3 months ago 45
C# Question

How to detect slash key using KeyDown event?

I can't find slash key in

Windows.System.Input.Key
enumeration.
Yes, I know, it's OEM key, but there is a key which produces slash on every keyboard, how can I detect it with any kind of
KeyDown
event?

Answer

You shouldn't.

Use the TextInput event and simply test for e.Text == "/".

(You may need to use PreviewTextInput for some controls that handle the bubbling event.)