Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
885
Key Down event with Alt + other keys not working
posted

Hi

  In our older Winforms grid screen we are using Alt + R, Alt + C etc short cuts . Now we moved to WPF & users

want the same shortcuts to work. I tried Preview_keyDown /KeyDown events it is not working. Attaching the

test app. Pls repy ms ASAP. We ahve release planned in a week

 

 

 

void xamDataGrid1_PreviewKeyDown(object sender, KeyEventArgs e)

{

 

if ((e.Key == Key.R || e.Key == Key.C) && Keyboard.Modifiers == ModifierKeys.Alt)

System.Windows.

MessageBox.Show("Got it");

}

 

 

 

 

Thanks for your help

 

KeyDown.zip
  • 138253
    Offline posted

    Hello,

    It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking through your post and I modified your sample, so now it has the functionality you want. Also I suggest you handle only the KeyDown event.

    Feel free to write me if you have further questions.

    KeyDown.zip