RadzenContextMenu component.
Object
ComponentBase
IComponent
IHandleEvent
IHandleAfterRender
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
public class RadzenContextMenu : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender@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");
}
}Gets the reference for the current component.
protected Microsoft.JSInterop.DotNetObjectReference<RadzenContextMenu> Reference { get; }
| Type | Description |
|---|---|
| Microsoft.JSInterop.DotNetObjectReference<RadzenContextMenu> | Gets the reference for the current component. |
Gets or sets the unique identifier.
public string UniqueID { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the unique identifier. |
protected override void BuildRenderTree(Rendering.RenderTreeBuilder __builder)
| Type | Name | Description |
|---|---|---|
| Rendering.RenderTreeBuilder | __builder |
protected override Task OnAfterRenderAsync(bool firstRender)
| Type | Name | Description |
|---|---|---|
| bool | firstRender |
| Type | Description |
|---|---|
| Task |
Opens the menu.
public Task Open(MouseEventArgs args, ContextMenuOptions options)
| Type | Name | Description |
|---|---|---|
| MouseEventArgs | args | The MouseEventArgs instance containing the event data. |
| ContextMenuOptions | options | The options. |
| Type | Description |
|---|---|
| Task |