【发布时间】:2016-02-10 03:50:29
【问题描述】:
我创建 Windows 通用应用程序。我想为 AppBarButton 添加快捷方式。可能吗?我在网络上没有找到任何关于它的信息。
【问题讨论】:
-
请澄清一下:据我了解,您想将
AppBarButtons 添加到您的AppBar,对吗?
标签: c# windows-10 win-universal-app hotkeys
我创建 Windows 通用应用程序。我想为 AppBarButton 添加快捷方式。可能吗?我在网络上没有找到任何关于它的信息。
【问题讨论】:
AppBarButtons 添加到您的AppBar,对吗?
标签: c# windows-10 win-universal-app hotkeys
我解决了这个问题。这个article 和这个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 。
【讨论】: