制作"全球"在WPF热键 [英] Making "global" hotkeys in WPF

查看:114
本文介绍了制作"全球"在WPF热键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在编程的主窗口由三个用户控件的应用程序。
在用户控件中的一个,有需要是通过键盘输入可控的滑块。左箭头应减少值,右边的按钮增加等。我有这个工作,但只有当滑块具有焦点。如果某些其他控件有焦点,我不能让它在所有的工作。

I'm programming an application consisting of three usercontrols in an main window. In one of the usercontrols, there's a slider that needs to be controllable by keyboard input. The left arrow should decrease value, right button increase and so on. I have this work, but only when the slider has focus. If some other control has focus, I cant make it work at all.

时可以定义全局热键? IE浏览器按键触发同一事件或功能,无论身在何处的重点是什么?希望我做了自己不够清晰...

Is it possible to define "global" hotkeys? IE keys that trigger the same event or function, no matter where the focus is? Hope I've made myself clear enough...

推荐答案

我从来没有尝试过这一点,但如果你有一个命令的注册主窗口水平与之关联的按键可能工作。请记住,我从来没有做过这却是有些事情你可以试试。如果你是新来这里的命令是博客文章吧

I have never tried this but If you have a command registered at the main window level with keys associated to it that might work. Keep in mind I have never done this but it is some thing you can try. If you are new to commands here is a blog post about it.

我从来没有推出这个我自己,但使用时,内置的过去命令其实我有在放码,以防止它在某些情况下发生的。

I have never rolled this my self but when using the built in past command I actually had to put code in to prevent it from happening in some cases.

我知道这可能是没有太大的帮助,但我希望这是足以让你开始。

I know this probably isn't much help but I hope it is enough to get you started.

这篇关于制作"全球"在WPF热键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆