How can i execute some command on, lets say, C开发者_如何学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);
精彩评论