如何捕获 Ctrl + Tab 和 Ctrl + 移位+ WPF 中的选项卡?
捕获 Ctrl+Tab 和 Ctrl+Shift+Tab 的示例代码是什么 对于 WPF 应用程序?
我们创建了 KeyDown
事件,并尝试添加带有输入手势的命令绑定,但我们始终无法捕获这两个快捷方式。
What would be some sample code that will trap the Ctrl+Tab and Ctrl+Shift+Tab for a WPF application?
We have created KeyDown
events and also tried adding command bindings with input gestures, but we were never able to trap these two shortcuts.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您好,您可以在 keydown 事件上使用它
Hi you can use this on keydown event
你有什么 KeyDown 处理程序? 下面的代码对我有用。 给我带来麻烦的是:Alt + Tab,但你没有要求这个:D
What KeyDown handler did you have? The code below works for me. The one that gives me trouble is: Alt + Tab, but you didn't ask for that :D
古斯塔沃的答案正是我想要的。 我们想要验证输入键,但仍然允许粘贴:
Gustavo's answer was exactly what I was looking for. We want to validate input keys, but still allow pasting:
您必须使用
KeyUp
事件,而不是KeyDown
...You have to use
KeyUp
event, notKeyDown
...Szymon Rozga 答案的工作版本(抱歉,我无法发表评论)。 我们不看Alt,但是它的记账可以简单地先添加if
Working version of Szymon Rozga answer (sorry, I can't comment). We don't look on Alt, but it's accounting can be simply added at first if