This is a migrated thread and some comments may be shown as answers.

RadRibbonDropDownButton - Open on F2 key

3 Answers 27 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Heiko
Top achievements
Rank 1
Iron
Veteran
Heiko asked on 05 May 2015, 09:12 AM

We have a RadRibbonDropDownButton declared inside a user control. What we like to achieve is to open the DropDown-Content by using F2 on the keyboard. Best would be without code behind (MVVM/PRISM). Unfortunately the "<UserControl.InputBindings>" are not working as expected. Is there another way to define a shortcut key on RadRibbonDropDownButton? n. b. this button is not inside a RibbonView, but used "as is" in a DockPanel.

Regards
Neils

3 Answers, 1 is accepted

Sort by
0
Kiril Vandov
Telerik team
answered on 06 May 2015, 08:27 AM
Hello Neils,

Let me try to explain when the InputBindings will be fired. In a regular case in which you have window and some controls in, by default the focus is inside the Window, that is why if you declare an InputBindings for the Window they will be triggered. However in the case where you have UserControl inside the Window, the ImputBindings for the UserControl will not be fired, unless you focus it.
If you entire application is hosted in that UserControl you could focus it once the is loaded and the bindings should work as expected. Another approach would be to declare the commands in both the Window and the UserControl to the same command. Using this approach will fire the command as you expected,

I hope this information helps. Please let us know if you need further assistance.

Kind regards,
Kiril Vandov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Heiko
Top achievements
Rank 1
Iron
Veteran
answered on 07 May 2015, 01:17 PM

Thanks Kiril, that brought some light on the matter. In my case (MVVM and PRISM) every View is a UserControl and is placed inside the ShellWindow via RegionManager. So there is no way to declare InputBindings in the ShellWindow.

Is there a way to declare a keyboard shortcut on a telerik control, lets say "whenever I press F2, fire the click event"?

Kind regards
Neils

0
Kiril Vandov
Telerik team
answered on 08 May 2015, 08:23 AM
Hello Neils,

We does not have such functionality in our controls as it is against how the .NET Framework and RouternEvents works. KeyBoradEvents are not fires beyond the Scope of the UserControl, they are fired only for the Window and the currently focused UserControl, however if the focus is in the Window and not in the UserControl only the Window will receive the events.

As a possible workaround for this scenario you could use the LoadedEvent of the UserControl and get its ParentWindow. After you get the Window you could subscribe to its KeyDownEvents and decide what to do when the Key you need is Pressed.

I hope this information helps.

Kind regards,
Kiril Vandov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Buttons
Asked by
Heiko
Top achievements
Rank 1
Iron
Veteran
Answers by
Kiril Vandov
Telerik team
Heiko
Top achievements
Rank 1
Iron
Veteran
Share this question
or