I have a KeyBinding
with the Key
set to D1 which is the 1
key. This isn't the same as NumPad1 key.
Is there a way to have something like:
Key="D1 && NumPad1"
So that pressing either D1 or NumPad1 would execute the command?
I've added a second KeyBinding one for each key D1 & NumPad1, but that seems like there should be a better way.
Yes you can - comma delimited :-)
I am not certain if in the question you want to use two KeyBindings to signify that user would have to push the key twice. But that's what I was looking for. If that's the reason then this post will work.
For example, I wanted to use + to go forward, and ++ to double-go-forward, and - to go-back, -- to go double back in my app:
<KeyBinding Key="OemMinus" Modifiers="Control" Command="{Binding GoBack}"/>
<KeyBinding Key="OemMinus,OemMinus" Modifiers="Control" Command="{Binding GoBack2X}"/>
The reason I figured it out, was that I know that in VisualStudio you have a ton of commands that have double key, like commenting, or collapsing regions. And you know that VS2010's written in WPF. So I looked on the VS menu, and there are ton of commands comma separated: View > Solution Navigator Cntr + W, F. I tried it and it worked!
No, you can't do that.
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