views:

132

answers:

1

How can i execute some command on, lets say, Ctrl+Shift+E? As i saw we can write the following:

KeyBinding kb = new KeyBinding(TestCommand, Key.E, ModifierKeys.Control);
this.InputBindings.Add(kb);


But how can i add more ModifierKeys or Keys?

+2  A: 

ModifiedKeys is a flags enumeration, so you can combine its values with the logical OR operator (|) as follows:

KeyBinding kb = new KeyBinding(TestCommand, Key.E, ModifierKeys.Control | ModifierKeys.Shift);
this.InputBindings.Add(kb);

HTH,
Kent

Kent Boogaart
Works :) My fault..I was trying to use the hotkey, that wasn't in binding(Alt instead of Shift)..Stupid mistake. Thank you for the answer.
nihi_l_ist