Bind Command to the HelpCommand property

Bind Command to the HelpCommand property

The RadRibbonView exposes a property called HelpCommand which can be bound to an object of type ICommand. This command will be executed when the built-in help button is clicked.

In this section we will demonstrate how to create a custom command and bind it to the HelpCommand property.

First let’s define the RadRibbonView in our view and set the HelpButtonVisibility to True.

<telerik:RadRibbonView HelpButtonVisibility="Visible" ApplicationButtonImageSource="Backstage_Icon.png"> 
    <telerik:RadRibbonTab Header="Home"> 
            <telerik:RadRibbonButton SmallImage="paste.png" Text="Paste" /> 
            <telerik:RadOrderedWrapPanel VerticalAlignment="Top"> 
            <telerik:RadRibbonButton SmallImage="copy.png" Text="Copy" /> 
            <telerik:RadRibbonButton SmallImage="cut.png" Text="Cut" /> 
    <telerik:RadRibbonTab Header="Insert" /> 
    <telerik:RadRibbonTab Header="References" /> 
Create a DelegateCommand object

public DelegateCommand OpenHelpPageCommand { get; set; } 
public MainWindow() 
    OpenHelpPageCommand = new DelegateCommand(ExecuteCommandHandler, CanExecuteCommandHandler); 
    this.DataContext = OpenHelpPageCommand; 

The HelpCommand property will accept every object that implements the ICommand interface. The DelegateCommand class implements the ICommand.

Implement your logic in the Execute and CanExecute handlers of the DelegateCommand

private bool CanExecuteCommandHandler(object obj) 
    // Implement logic that checks if the button command can be executed 
    return true; 
private void ExecuteCommandHandler(object obj) 
    // Implement the logic that should be executed when the button is clicked 
    MessageBox.Show("Help Command Executed"); 
Private Function CanExecuteCommandHandler(obj As Object) As Boolean 
    ' Implement logic that checks if the button command can be executed' 
    Return True 
End Function 
Private Sub ExecuteCommandHandler(obj As Object) 
    ' Implement the logic that should be executed when the button is clicked' 
    MessageBox.Show("Help Command Executed") 
End Sub 

Finally you can bind the command

<telerik:RadRibbonView HelpButtonVisibility="Visible" HelpCommand="{Binding}" /> 

In addition you can use the HelpCommandParameter and the HelpCommandTarget properties of the RadRibbonView in order to pass additional data to the command.

You can download a runnable project of the demonstrated example from our online SDK repository here, after navigating to RibbonView/HelpFunctionality.

See Also

In this article
Not finding the help you need? Improve this article