为关键手势分配多个修改键不支持SHIFT + F.

Wel*_*ing 7 c# wpf keyboard-shortcuts

我有以下代码:

MyPlayPause.InputGestures.Add(new KeyGesture(Key.P, ModifierKeys.Control));
Run Code Online (Sandbox Code Playgroud)

我需要添加另一个gesure所以我可以移位+ CTRL + P但是当我添加选项时它会中断:

MyPlayPause.InputGestures.Add(new KeyGesture(Key.P, ModifierKeys.Control));
Run Code Online (Sandbox Code Playgroud)

转移选项.我收到此错误:'Shift+F' key and modifier combination is not supported for KeyGesture.

知道为什么吗?我需要复制Media Player快进按钮的功能.

Jal*_*aid 20

ModifierKeys枚举是标记的,[FlagsAttribute]所以你可以这样做:

ModifierKeys.Control | ModifierKeys.Shift
Run Code Online (Sandbox Code Playgroud)

所以:

MyPlayPause.InputGestures.Add(new KeyGesture(Key.P, ModifierKeys.Control |  ModifierKeys.Shift));
Run Code Online (Sandbox Code Playgroud)