是否可以通过键盘输入切换菜单?
我正在为特殊用途的硬件构建一个仪表板式应用程序,该硬件具有绑定到 F1-F10、向上、向下、退格键、Enter 的物理按钮。 该应用程序由几个视图组成(使用 MVVM 模式实现),大部分用户交互都是通过靠近物理按钮对齐的菜单完成的。 我试图通过按 F 键来切换菜单状态,但我就是无法让该死的东西工作!
我(有点成功)尝试了一种替代解决方案,该解决方案捕获 F 键并将它们作为常规数字 1-10 发送,并使用 Accesskey 将 Alt+[1-10] 映射到菜单。 但这不是最佳解决方案,因为我必须跟踪菜单是否失去焦点(用户也可以使用触摸屏导航)。 除此之外,我还尝试从 menuitem-header 中隐藏 accesskey-text (因为似乎不可能使其不可见)。
I'm building a dashboard'ish application for a special purpose hardware that has physical buttons that are bound to F1-F10, Up, Down, Backspace, Enter. The application consists of a few views (implemented using the MVVM-pattern) and most of the user interaction are done with menus that are aligned near the physical buttons. I'm trying to toggle the menu state by pressing the F-keys but I just can't get the bloody thing to work!
I've (successfully, kinda) tried an alternative solution that catches the F-keys and sends them as regular numbers 1-10 and mapping Alt+[1-10] to the meny using Accesskey. That is not an optimal solution though since I have to keep track of if the menu looses focus (the user can also navigate with a touch screen). Besides that I also have try and hide the accesskey-text from the menuitem-header (since it seems impossible to just make it invisible).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
老实说,我只是制作一个常规窗口并根据需要隐藏/显示它 - 只需有一个 ItemsControl,其 DataTemplate 是 MenuItem。 菜单以标准“菜单”方式进行管理,因此很难覆盖它并手动管理隐藏/显示状态。
Honestly, I'd just make a regular Window and hide/show it as appropriate - just have an ItemsControl whose DataTemplate is a MenuItem. Menus are managed in the standard "menu" way, so it'll be hard to override it and manually manage the hidden/shown state.