How to assign a shortcut key to the ribbon button.

Ribbon for WPF Forum

Posted 15 years ago by Raghuraj
Version: 4.5.0477
Avatar
Hi,

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


Thanks

Raghuraj

Comments (3)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
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 14 years ago by Alex B
Avatar
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?

Thanks,

Alex
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
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.1) was released 22 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.