I'm working on wpf c# application and I need to detect when user press "/" but I'm having trouble with finding " / " e.Key, I saw there is Key.OemBackslash
and stuffs like that, but I can't find right event for " / " (forward slash) ...
Thanks guys, Cheers
On English keyboards, the forward slash is on the same key as the question mark key next to the right Shift key.
Try the Keyboard Troubleshooter at Settings > Update & Security > Troubleshoot. Check also at Settings > Time & Language > Region & Language to make sure the correct Language appears, then choose Advanced Keyboard Settings to see if a different input method is chosen in the dropdown menu.
Creating the \ symbol on a U.S. keyboard On English PC and Mac keyboards, the backslash key is also the pipe key. It is located above the Enter key (Return key), and below the Backspace key. Pressing \ key creates a backslash.
It should be Key.OemQuestion
on a US keyboard. But on a Swedish keyboard it is D7
so it depends. The keys on the keyboard doesn't always produce the same character.
Depending on what you are trying to do you may be better off handling the PreviewTextInput
event:
protected override void OnPreviewTextInput(TextCompositionEventArgs e)
{
base.OnPreviewTextInput(e);
if (e.Text == "/")
{
Debug.WriteLine("...");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With