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 + =:
Requested value '=' was not found.
Any ideas?
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.
So your XAML should be (in Denmark):
<KeyBinding Command="{Binding Content.ZoomInCommand}" Gesture="Ctrl+Shift+D0"/>
EDIT: I believe on an American system it is the OemPlus
key - but you can check it by console-writeline'ing the e.Key
argument in a key-down event handler)
EDIT2: the - key is OemMinus
on my system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With