Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assigning more than one Modifier Keys to a Key Gesture SHIFT + F not supported

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.

like image 461
Welsh King Avatar asked Jul 28 '11 08:07

Welsh King


People also ask

What are the 2 modifier keys on keyboard?

Modifier keys on personal computers. The most common are: ⇧ Shift. ⌃ Ctrl (Control)

How many modifier keys are there in keyboard?

Four keys on your keyboard are modifier keys. A modifier key works in combination with other keys to do various interesting and unbelievable things.

Is Shift modifier a key?

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.


1 Answers

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));
like image 188
Jalal Said Avatar answered Sep 28 '22 03:09

Jalal Said