Help me
I create a KeyDown event here:
private void Window_KeyDown(object sender, KeyEventArgs e)
{
if(e.Key== Keys.Enter)
{
MessageBox.Show("Enter is pressed");
}
}
But problem is when I click "Enter" with shift or Ctlr or other key
Same result will be shown.
I want to create only Keys.Enter other command will not be shown.
Please help me
I haven't tried this, but it looks like you could just check the modifiers for the associated keyboard device:
if (e.Key == Keys.Enter && e.KeyboardDevice.Modifiers == ModifierKeys.None)
{
...
}
See more on this question at Stackoverflow