locked
How to handler multiple keyboard?

    Question

  • Hi,

    Q: Add keyboard shortcut (Window+1) to toggle Output State on/off

    Consider following codes, it doesn't work!.

    private void Grid_KeyDown(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
            {
                if ((e.Key == VirtualKey.RightWindows) && (e.Key == VirtualKey.NumberPad1))
                {
                   // Business logic
                }
                //else  e.Handled = true;
            }

    Best Regards,

    WP

    Tuesday, November 18, 2014 2:50 PM

Answers

  • Only one key will be reported in the KeyDown message itself. It can't be both NumberPad1 and RightWindows.

    You can use CoreWindow.GetKeyState to find the current state of other keys.

    Tuesday, November 18, 2014 6:24 PM
    Owner

All replies

  • Only one key will be reported in the KeyDown message itself. It can't be both NumberPad1 and RightWindows.

    You can use CoreWindow.GetKeyState to find the current state of other keys.

    Tuesday, November 18, 2014 6:24 PM
    Owner
  • Hi Rob Caplan ,

    Thanks, I have got similar idea but this is the right way and it works.

    Best Regards,

    WP

    Tuesday, November 18, 2014 8:24 PM