Should be a simple one, but I can't work out how to do it. Using WPF4 I want to Bind Ctrl + - to Zoom Out and Ctrl + = to Zoom In:
<KeyBinding Command="{Binding Content.ZoomInCommand}" Gesture="Ctrl+="/>
<KeyBinding Command="{Binding Content.ZoomOutCommand}" Gesture="Ctrl+-"/>
However, I'm getting errors: in the case of Ctrl + =:
未找到请求的值“=”。
有任何想法吗?
Okay - it turns out that the = key does not exist (you can check this through the Key
-enumeration - there is no entry for Equal or EqualSign)... I use an international keyboard, so you have to find which key sequence you hit to enter = (for me it's Shift + D0 on a danish keyboard) - and use that key-sequence.
所以你的 XAML 应该是(在丹麦):
<KeyBinding Command="{Binding Content.ZoomInCommand}" Gesture="Ctrl+Shift+D0"/>
编辑:我相信在美国系统上它是OemPlus
键 - 但您可以通过 console-writeline 检查它e.Key
按键事件处理程序中的参数)
EDIT2: the - key is OemMinus
on my system.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)