New to Telerik UI for WinUI? Download free 30-day trial

RadialMenu Commands

The RadRadialMenu control supports the following commands:

  • Open Command: Executes before the RadRadialMenu opens.
  • Close Command: Executes before the RadRadialMenu closes.
  • NavigateToView Command: Executes before the user navigate to another view (child items). This command receives a context of type NavigateContext, which exposes the following properties:
    • MenuItemTarget: Gets the current RadialMenuItem that has beend clicked/tapped.
    • MenuItemSource: Gets the previous (if any) RadialMenuItem that has been used to navigate navigated through.

RadRadialMenu exposes a commands collection that allows you to register custom commands with each control's instance through the RadRadialMenu.Commands property.

To implement a command you need to create a class that derives from the RadialMenuCommand class and override the CanExecute and Execute methods.

The RadialMenuCommand class exposes the following properties:

  • Id: This value is used to associate a command with a known event within a RadRadialMenu instance.
  • Owner: Gets the RadRadialMenu instance that has executed this command.

Custom commands have higher priority than the default commands.

Example

Here is an example of how to implement custom command that will be executed when the user navigates to the children of a menu item:

First, you can create a custom class that derives from the RadialMenuCommand class. You need to set the Id of the command to specify when it will be executed. If you wish to execute the default behavior, then you have to call the Owner.CommandService.ExecuteDefaultCommand method in the Execute method of the command.

You can access the RadRadialMenu control through an alias pointing to the Telerik.UI.Xaml.Controls.Navigation namespace: xmlns:navigation="using:Telerik.UI.Xaml.Controls.Navigation"

Example 1: Custom Command

public class CustomMenuCommand : RadialMenuCommand 
{ 
    public CustomMenuCommand() 
    { 
        this.Id = CommandId.NavigateToView; 
    } 
 
    public override void Execute(object parameter) 
    { 
        base.Execute(parameter); 
 
        var context = parameter as NavigateContext; 
        var source = context.MenuItemSource; // parent menu item 
        var target = context.MenuItemTarget; // current menu item 
 
        // put your custom command logic here 
 
        this.Owner.CommandService.ExecuteDefaultCommand(CommandId.NavigateToView, context); 
    } 
 
    public override bool CanExecute(object parameter) 
    { 
        return true; 
    } 
} 
Then you can add the custom command class in the Commands collection of the RadRadialMenu.

Example 1: Custom Command

<navigation:RadRadialMenu> 
    <navigation:RadRadialMenu.Commands> 
        <local:CustomMenuCommand/> 
    </navigation:RadRadialMenu.Commands> 
 
    <navigation:RadialMenuItem Header="Item 1" > 
        <navigation:RadialMenuItem.ChildItems> 
            <navigation:RadialMenuItem Header="Item 1.1"> 
                <navigation:RadialMenuItem.ChildItems> 
                    <navigation:RadialMenuItem Header="Item 1.1.1" /> 
                </navigation:RadialMenuItem.ChildItems> 
            </navigation:RadialMenuItem> 
            <navigation:RadialMenuItem Header="Item 1.2" > 
                <navigation:RadialMenuItem.ChildItems> 
                    <navigation:RadialMenuItem Header="Item 1.2.1" /> 
                </navigation:RadialMenuItem.ChildItems> 
            </navigation:RadialMenuItem> 
        </navigation:RadialMenuItem.ChildItems> 
    </navigation:RadialMenuItem> 
</navigation:RadRadialMenu> 
In this article
Not finding the help you need?