KeyGesture does not accept Shift + Alphanumeric

I am trying to execute some WPF commands using the WPF KeyGesture class. The application works fine until I specify a key combination consisting of a Shift modifier and an alphanumeric key. For example, after creating an instance: new KeyGesture(Key.M, ModifierKeys.Shift) throws an exception:

Component

"Shift + M" and the modifier are not supported for KeyGesture.

The Bare Shift modifier will also not work with numbers (for example, Shift + 2 ). However, the combination of Shift + Insert or Shift + F1 works flawlessly. Just to be clear, there are no problems with Shift + Ctrl , Shift + Alt or Alt + 1 and the same.

Why was it decided to ban Shift + [Alphanumeric] gesture? Does it have anything to do with capitalization? Is there a workaround related to the WPF management system? (Note: I am not trying to use the Shift + M gesture when filling in text fields, but if it is not in focus).

It seems that I found only one entry in the forum where this problem was raised. Failed to search for documentation. Is it so obvious to developers to avoid Shift + [Alphanumeric]?

+4
source share
1 answer

See SO 8251043 - basically this is no longer a β€œgesture”, but a keyword. Create a simple, unmodified key binding in WPF

+3
source

All Articles