tags:

views:

132

answers:

1

I have a menuitem which have a command assigned to it (MyCommands.Indent) and two text areas, both having an input binding triggering MyCommands.Indent. The hard part is that input bindings have different gestures and I would like these gestures to change in MenuItem.

So my question is: How do I get input bindings which would trigger this routed command?

A: 

The only way I can see to do specifically what you're asking, is to explore the visual tree to find items with InputBindings to your RoutedCommand... not a very nice thought !

But there might be a better approach : what don't you just define the shortcut in the RoutedCommand, using the InputGestures property ? That way you won't be needing the InputBindings anymore...

Thomas Levesque
Because I'm extending CommandManager to allow user (not developer) to modify gestures. If user will modify gestures he will (through unknowingly) do it by modifying InputBindings. Now imagine he will set two different gestures. What should I display?
Sergej Andrejev
the user could modify the RoutedCommand.InputGestures, rather than InputBindings...
Thomas Levesque
Yes I went with simmilar sollution. I go through all input bindings and combine all the gestures in them. Then I modify RoutedCommand.InputGestures
Sergej Andrejev