RadzenContextMenu Class

RadzenContextMenu component.

Inheritance

Object

ComponentBase

RadzenContextMenu

Implements

IComponent

IHandleEvent

IHandleAfterRender

Inherited Members

ComponentBase.OnInitializedAsync

ComponentBase.OnParametersSet

ComponentBase.OnParametersSetAsync

ComponentBase.StateHasChanged

ComponentBase.ShouldRender

ComponentBase.OnAfterRender

ComponentBase.InvokeAsync

ComponentBase.DispatchExceptionAsync

ComponentBase.SetParametersAsync

ComponentBase.RendererInfo

ComponentBase.Assets

ComponentBase.AssignedRenderMode

Namespace: Radzen.Blazor

Assembly: Radzen.Blazor.dll

Syntax

public class RadzenContextMenu : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender

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

RadzenContextMenulink

RadzenContextMenu component.

Declaration
public RadzenContextMenu()

Properties

Referencelink

Gets the reference for the current component.

Declaration
protected Microsoft.JSInterop.DotNetObjectReference<RadzenContextMenu> Reference { get; }
Property Value
Type Description
Microsoft.JSInterop.DotNetObjectReference<RadzenContextMenu>Gets the reference for the current component.

UniqueIDlink

Gets or sets the unique identifier.

Declaration
public string UniqueID { get; set; }
Property Value
Type Description
stringGets or sets the unique identifier.

Methods

BuildRenderTreelink

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

Closelink

Closes this instance.

Declaration
public Task Close()
Returns
Type Description
Task

CloseMenulink

Closes this instance.

Declaration
public void CloseMenu()

DisposeAsynclink

Declaration
public ValueTask DisposeAsync()
Returns
Type Description
ValueTask

OnAfterRenderAsynclink

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

OnInitializedlink

Declaration
protected override void OnInitialized()

Openlink

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
An error has occurred. This app may no longer respond until reloaded. Reload 🗙