Demos About Radzen
Search Results for

    Show / Hide Table of Contents

    Class RadzenContextMenu

    RadzenContextMenu component.

    Inheritance
    object
    ComponentBase
    RadzenContextMenu
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IAsyncDisposable
    Inherited Members
    ComponentBase.OnInitializedAsync()
    ComponentBase.OnParametersSet()
    ComponentBase.OnParametersSetAsync()
    ComponentBase.StateHasChanged()
    ComponentBase.ShouldRender()
    ComponentBase.OnAfterRender(bool)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.DispatchExceptionAsync(Exception)
    ComponentBase.SetParametersAsync(ParameterView)
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Radzen.Blazor
    Assembly: Radzen.Blazor.dll
    Syntax
    public class RadzenContextMenu : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender, 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");
      }
    }

    Constructors

    RadzenContextMenu()

    RadzenContextMenu component.

    Declaration
    public RadzenContextMenu()
    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
    string

    The unique identifier.

    Methods

    BuildRenderTree(RenderTreeBuilder)

    RadzenContextMenu component.

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    RenderTreeBuilder __builder
    Overrides
    ComponentBase.BuildRenderTree(RenderTreeBuilder)

    Close()

    Closes this instance.

    Declaration
    public Task Close()
    Returns
    Type Description
    Task

    CloseMenu()

    Closes this instance.

    Declaration
    [JSInvokable("RadzenContextMenu.CloseMenu")]
    public void CloseMenu()

    DisposeAsync()

    RadzenContextMenu component.

    Declaration
    public ValueTask DisposeAsync()
    Returns
    Type Description
    ValueTask

    OnAfterRenderAsync(bool)

    RadzenContextMenu component.

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    bool firstRender
    Returns
    Type Description
    Task
    Overrides
    ComponentBase.OnAfterRenderAsync(bool)

    OnInitialized()

    RadzenContextMenu component.

    Declaration
    protected override void OnInitialized()
    Overrides
    ComponentBase.OnInitialized()

    Open(MouseEventArgs, ContextMenuOptions)

    Opens the menu.

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

    The MouseEventArgs instance containing the event data.

    ContextMenuOptions options

    The options.

    Returns
    Type Description
    Task

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IAsyncDisposable

    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