将 WPF 窗口聚焦在快捷键上
我创建了一个 WPF 应用程序,如果用户按 ctl + alt + s,我的 WPF 应用程序文本框需要获得焦点。
示例:如果您按 ctl+w,单词 web 将自动获得焦点。
提前致谢。
I have created a WPF application, where if user press ctl + alt + s, my WPF application textbox needs to be focused.
Example: if you press ctl+w, automatically word web will get focused.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 InputBindings,定义一个 KeyBinding 并创建一个 进行聚焦的命令。
Use InputBindings, define a KeyBinding and create a command which does the focusing.
您可以订阅
PreviewKeyDown
事件:You can subscribe to
PreviewKeyDown
event:您可以使用低级键盘挂钩
http:// /blogs.msdn.com/b/toub/archive/2006/05/03/589423.aspx
You can achive this by using low level keyboard hook
http://blogs.msdn.com/b/toub/archive/2006/05/03/589423.aspx