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

Press F1 for help example

2 Answers 136 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 14 Mar 2014, 02:48 PM
In the Q1-2014 release notes, it is mentioned that the screentip now supports "Press F1 for help" functionality but I am not able to find an example in the documentation nor online. Can you point me to a working example or documentation that outlines this feature.

Thanks,
Shawn

2 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 19 Mar 2014, 04:07 PM
Hello Shawn,

In order to perform an action when you press F1 you can create a new DelegateCommand which opens a new window (or a page) with the help information on execute. Then you can add a KeyBinding in order to use the F1 key and bind the command to the HelpCommand property of the RadRibbonView. Here is an example in code:
public partial class MainPage : UserControl
{
    public MainPage()
    {
        InitializeComponent();
 
        OpenHelpPageCommand = new DelegateCommand(ExecuteOpenHelpPage);
        this.DataContext = OpenHelpPageCommand;
        InputBindingCollection inputBindCollection = new InputBindingCollection();
        inputBindCollection.Add(new KeyBinding(this.OpenHelpPageCommand,new KeyGesture(Key.F1)));
        CommandManager.SetInputBindings(this, inputBindCollection);
    }
 
    private void ExecuteOpenHelpPage(object obj)
    {
        var helpWindow = MyHelpWindow.Instance;
        helpWindow.Show();
    }
 
    public DelegateCommand OpenHelpPageCommand { get; set; }
}
Here is the Xaml definition:
<telerik:RadRibbonView HelpButtonVisibility="Visible" HelpCommand="{Binding}" HelpButtonStyle="{StaticResource helpButtonStyle}" />

To show the screen tip of the help button you can define a style which sets the tip.
<UserControl.Resources>
    <Style x:Key="helpButtonStyle" TargetType="telerik:RadButton">
        <Setter Property="telerik:ScreenTip.Title" Value="Press F1 for help" />
    </Style>
</UserControl.Resources>

For your convenience I prepared a sample project which you could use as a sample implementation of your requirement.

Regards,
Martin
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Wayne
Top achievements
Rank 1
answered on 05 May 2016, 08:42 AM
For reference, if you want the Telerik RadRibbonView Help button to work (do something when you click on it), then make sure to not do the obvious (set your help ICommand on the ribbon HelpButton.Command property), but instead do the less obvious step of setting the HelpCommand property on the ribbon instead. Hopefully this saves someone else the 20 minutes I just wasted wondering why the Help button refused to work like every other button does.
Tags
RibbonView and RibbonWindow
Asked by
David
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Wayne
Top achievements
Rank 1
Share this question
or