How to assign a shortcut key to the ribbon button.

Ribbon for WPF Forum

Posted 16 years ago by Raghuraj
Version: 4.5.0477

how can i assign a shortcut key (e.g. Ctrl+A) to the ribbon button.



Comments (3)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Raghuraj,

That can be done through the use of WPF commands. If you set an input binding to a WPF command and use that command on a ribbon button, it should respond to the input.

Actipro Software Support

Posted 15 years ago by Alex B
How does your solution work for toggle buttons? I have a Bold ribbon button that provides a CheckableCommandParameter in the EventArgs so that I can keep track of the state of the button. However, when the CanExecute fires as a result of the keyboard shortcut, the parameter is null. Can you make a suggestion?


Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Alex,

When you register a shortcut key binding with a command, the Microsoft code that watches for that key shortcut has no tie at all to the UI buttons that may also use that command. Thus the parameter passed in that scenario is null since it's not coming from the button. The KeyBinding uses it's own CommandParameter property, which you would need to set.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.