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?
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?
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