This question is locked. New answers and comments are not allowed.
Hi,
I have a toolbar with a button on it like this:
This xaml is part of a user control called MainPage which gets loaded in a user control called Shell, which gets loaded in App.xaml
Client asked to have keyboard shortcuts for my RadToolbar commands, like (Ctrl+Shift+S) for the save button.
I know RadToolbar doesn't support this yet, so I started coding a solution which handles key down evens in the user control "Shell":
This works well in IE. In all the other browsers I have to first click somewhere inside shell, and only then will the keyboard shortcuts work.
I think it has to do with the fact that no control has the focus.
All I have on the MainPage user control, when it's initially loaded is a toolbar with some buttons.
I've tried setting the focus on a RadButton from the toolbar explicitly, in the LoadedEvent of the user control, but it doesn't work.
Any thoughts on how I could accomplish this?
I have a toolbar with a button on it like this:
<telerik:RadToolBar Grid.Row="1" OverflowButtonVisibility="Visible" MouseLeftButtonDown="UIElement_OnMouseLeftButtonDown"> <telerik:RadButton x:Name="newButton" Command="{Binding CreateNewCommand}"> <StackPanel Orientation="Horizontal"> <Image Source="../NewDocument.png" Stretch="None"/> <TextBlock Text="New" VerticalAlignment="Center" Margin="5,0,5,0"/> </StackPanel> </telerik:RadButton>...This xaml is part of a user control called MainPage which gets loaded in a user control called Shell, which gets loaded in App.xaml
Client asked to have keyboard shortcuts for my RadToolbar commands, like (Ctrl+Shift+S) for the save button.
I know RadToolbar doesn't support this yet, so I started coding a solution which handles key down evens in the user control "Shell":
public Shell() { InitializeComponent(); AddHandler(UIElement.KeyDownEvent, new KeyEventHandler(Shell_OnKeyDown), true); } private void Shell_OnKeyDown(object sender, KeyEventArgs e) { if (Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift) && e.Key == Key.S) { //do something } }This works well in IE. In all the other browsers I have to first click somewhere inside shell, and only then will the keyboard shortcuts work.
I think it has to do with the fact that no control has the focus.
All I have on the MainPage user control, when it's initially loaded is a toolbar with some buttons.
I've tried setting the focus on a RadButton from the toolbar explicitly, in the LoadedEvent of the user control, but it doesn't work.
Any thoughts on how I could accomplish this?