How can I set InputGestureText automatically in all menus?

In WinForms, I can specify a keyboard shortcut for a command and it will appear automatically in the menu item. In fact, this was also true in Delphi, more than ten years ago.

In WPF, however, I bind the input gestures in one place and then have to remember to set InputGestureText

each time I use the input gesture manually.

How can I get all InputGestureTexts in all menus in my application to be automatically set based on the current key binding?


source to share

1 answer

There is no automation built in as far as I know, but that shouldn't stop you from doing it yourself, shouldn't be too hard. You can iterate through the menu tree and add InputGestureText

based on InputBindings

or do it the other way around (preferably with support for a hierarchy of model views).



All Articles