Showing posts with label mouse. Show all posts
Showing posts with label mouse. Show all posts

Wednesday, February 06, 2013

Using key gestures with parameterized Commands in WPF is "broken"

Ok, it's not actually broken, it just doesn't work the way I wanted (or expected). Apparently, there's a very good article on why they don't work the way I expected. To be clear, the way I expected them to work was:

  1. Define the command as a static RoutedUICommand and set the keyboard / mouse gestures I wanted on the command's InputGestures collection.
  2. Use said command in MenuItems, Buttons etc.
  3. Automatically have keyboard / mouse bindings setup everywhere (including the nice shortcut text on menu items in context menus / menu bar menus)
Turns out, no, and it's by design of the WPF team. See the article above for the explanation. At least now I know there's a good reason why it's not working, and I have a starting point for getting the key / mouse gesture functionality that I want.