I am writing a WPF application with just a few commands, so I am using a toolbar, without a menu. I would like to assign ctrl-key shortcuts to the buttons on the toolbar. Is there a simple way to do this, without having to create routed commands or ICommands just to support the shortcuts? I would prefer to do it in XAML, rather than code-behind.
Share
I have come to the conclusion that WPF doesn’t provide a simple way to add a Ctrl-key to a button. I solved my problem by trapping keypresses in the code-behind, and then invoking the appropriate ICommand–the ICommand that the corresponding button’s Command property is bound to. It’s a bit of an ugly hack, but it works, and it seems to be the best approach under the circumstances.