Can a WPF KeyBinding Key have multiple values

I have a KeyBinding with a key set to D1, which is 1 key. This is not the same as the NumPad1 key.
Is there a way to have something like:

Key="D1 && NumPad1" 
+4
source share
2 answers

No, you cannot do this.

+4
source

Yes, you can - separate with commas :-)

I'm not sure if in the question you want to use two KeyBindings to show that the user will have to double-click the key. But this is what I was looking for. If this is the reason, then this mail will work.

For example, I wanted to use + to go forward, and ++ - to double jump and - to return - to return twice to my application:

 <KeyBinding Key="OemMinus" Modifiers="Control" Command="{Binding GoBack}"/> <KeyBinding Key="OemMinus,OemMinus" Modifiers="Control" Command="{Binding GoBack2X}"/> 

The reason I realized this was because I know that in VisualStudio you have a ton of double-key commands, such as comments or collapsing areas. And you know that VS2010 is written in WPF. So I looked at the VS menu, and there are a lot of commands separated by commas: View> Cntr + W Solution Navigator F. I tried it and it worked!

+6
source

All Articles