Windows 通用应用程序和热键
Windows universal app and hot keys
我创建 windows 通用应用程序。我想为 AppBarButton 添加快捷方式。可能吗?我在网络上没有找到任何关于它的信息。
我解决了这个问题。这个 article and this article 帮助我。如果没有控制输入可以使用这个代码:
// Listen to the window directly so focus isn't required
Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated +=
CoreDispatcher_AcceleratorKeyActivated;
Window.Current.CoreWindow.PointerPressed += this.CoreWindow_PointerPressed;
这是 example 使用的 AcceleratorKeyActivated 。
我创建 windows 通用应用程序。我想为 AppBarButton 添加快捷方式。可能吗?我在网络上没有找到任何关于它的信息。
我解决了这个问题。这个 article and this article 帮助我。如果没有控制输入可以使用这个代码:
// Listen to the window directly so focus isn't required
Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated +=
CoreDispatcher_AcceleratorKeyActivated;
Window.Current.CoreWindow.PointerPressed += this.CoreWindow_PointerPressed;
这是 example 使用的 AcceleratorKeyActivated 。