I have the following code:
MyPlayPause.InputGestures.Add(new KeyGesture(Key.P, ModifierKeys.Control));
I need to add another gesure SO I CAN HAVE SHIFT + CTRL + P but it breaks when i add the option for:
MyPlayPause.InputGestures.Add(new KeyGesture(Key.P, ModifierKeys.Control));
shift option. I get this error: 'Shift+F' key and modifier combination is not supported for KeyGesture.
Any idea why? I need to replicate the functionality of the Media Player fast forward button.
Modifier keys on personal computers. The most common are: ⇧ Shift. ⌃ Ctrl (Control)
Four keys on your keyboard are modifier keys. A modifier key works in combination with other keys to do various interesting and unbelievable things.
The Shift key ⇧ Shift is a modifier key on a keyboard, used to type capital letters and other alternate "upper" characters. There are typically two shift keys, on the left and right sides of the row below the home row.
ModifierKeys
enum is a marked as [FlagsAttribute]
so you can do:
ModifierKeys.Control | ModifierKeys.Shift
So:
MyPlayPause.InputGestures.Add(new KeyGesture(Key.P, ModifierKeys.Control | ModifierKeys.Shift));
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