Demos About Radzen
Search Results for

    Show / Hide Table of Contents

    Class RadzenContextMenu

    RadzenContextMenu component.

    Inheritance
    System.Object
    RadzenContextMenu
    Namespace: Radzen.Blazor
    Assembly: Radzen.Blazor.dll
    Syntax
    public class RadzenContextMenu : IAsyncDisposable
    Examples
    @inject ContextMenuService ContextMenuService
    
    <RadzenButton Text="Show context menu" ContextMenu=@(args => ShowContextMenuWithItems(args)) />
    
    @code {
      void ShowContextMenuWithItems(MouseEventArgs args)
      {
        ContextMenuService.Open(args,
            new List<ContextMenuItem> {
                new ContextMenuItem() { Text = "Context menu item 1", Value = 1 },
                new ContextMenuItem() { Text = "Context menu item 2", Value = 2 },
                new ContextMenuItem() { Text = "Context menu item 3", Value = 3 },
         }, OnMenuItemClick);
      }
    
      void OnMenuItemClick(MenuItemEventArgs args)
      {
        Console.WriteLine($"Menu item with Value={args.Value} clicked");
      }
    }

    Properties

    Reference

    Gets the reference for the current component.

    Declaration
    protected DotNetObjectReference<RadzenContextMenu> Reference { get; }
    Property Value
    Type Description
    DotNetObjectReference<RadzenContextMenu>

    The reference.

    UniqueID

    Gets or sets the unique identifier.

    Declaration
    public string UniqueID { get; set; }
    Property Value
    Type Description
    System.String

    The unique identifier.

    Methods

    Close()

    Closes this instance.

    Declaration
    public async Task Close()
    Returns
    Type Description
    Task

    CloseMenu()

    Closes this instance.

    Declaration
    public void CloseMenu()

    DisposeAsync()

    Declaration
    public async ValueTask DisposeAsync()
    Returns
    Type Description
    ValueTask

    OnAfterRenderAsync(Boolean)

    Declaration
    protected override async Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    System.Boolean firstRender
    Returns
    Type Description
    Task

    OnInitialized()

    Declaration
    protected override void OnInitialized()

    Open(MouseEventArgs, ContextMenuOptions)

    Opens the menu.

    Declaration
    public async Task Open(MouseEventArgs args, ContextMenuOptions options)
    Parameters
    Type Name Description
    MouseEventArgs args

    The instance containing the event data.

    ContextMenuOptions options

    The options.

    Returns
    Type Description
    Task

    Introducing Radzen Blazor Studio

    Radzen Blazor Studio is a software development environment that empowers developers to design, build and deploy Blazor applications without the traditional hurdles. Write less code and get more done.

    Learn More

    Download Now
    Download Now
    In This Article
    Back to top Radzen Blazor Components, © 2018-2025 Radzen. Source Code licensed under MIT