@inject ContextMenuService ContextMenuService

<RadzenStack Gap="1rem" class="rz-p-sm-12">
    <RadzenButton Text="Right click me" ContextMenu=@(args => ShowContextMenuWithItems(args)) ButtonStyle="ButtonStyle.Secondary" Size="ButtonSize.Large" />
    <EventConsole @ref=@console />
</RadzenStack>

@code {
    EventConsole console;

    void ShowContextMenuWithItems(MouseEventArgs args)
    {
        ContextMenuService.Open(args,
            new List<ContextMenuItem> {
                new ContextMenuItem(){ Text = "Context menu item 1", Value = 1, Icon = "home" },
                new ContextMenuItem(){ Text = "Context menu item 2", Value = 2, Icon = "search", Disabled = true },
                new ContextMenuItem(){ Text = "Context menu item 3", Value = 3, Icon = "info" },
         }, OnMenuItemClick);
    }

    void OnMenuItemClick(MenuItemEventArgs args)
    {
        console.Log($"Menu item with Value={args.Value} clicked");
        if(!args.Value.Equals(3) && !args.Value.Equals(4))
        {
            ContextMenuService.Close();
        }
    }
}