How to detect ALT (Menu) button keydown on global page level in a WinRT app

本秂侑毒 提交于 2019-12-11 19:39:45

问题


I use following code to detect all key events in a WinRT app page:

Window.Current.CoreWindow.KeyDown += CoreWindow_KeyDown;
...

private void CoreWindow_KeyDown(CoreWindow sender, KeyEventArgs args)
{
  //Handle key event
}

But the Alt (Menu in the VirtualKey enumeration) key does not trigger the CoreWindow.KeyDown event. It does also block any other key to trigger the event while pressed.

Anyone know how to detect the Alt keydown event on a global page level in a WinRT app?


回答1:


It seems to be a bug Unexpected behavior in Windows.Core.UI.CorePhysicalKeyStatus.IsMenuKeyDown.

Though I tried Dispatcher.AcceleratorKeyActivated, it handles Alt key.



来源:https://stackoverflow.com/questions/17186280/how-to-detect-alt-menu-button-keydown-on-global-page-level-in-a-winrt-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!