ContextMenuItemClickEventArgs Class

Provides data for the ItemClick event.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.dll

Declaration

public class ContextMenuItemClickEventArgs :
    EventArgs

Remarks

Use the ItemClick event to specify a common click handler that should be applied to all menu items.

<div class="card-header">
    @if (ClickedItem != null) {
        <span>Clicked item: <b>@ClickedItem</b></span>
    }
    else {
        <span>Clicked item: None</span>
    }
</div>

<DxContextMenu ItemClick="@OnItemClick">
    <Items>
        <DxContextMenuItem Text="Sort By" IconUrl="images/Sort_by.svg">
            <Items>
                <DxContextMenuItem Text="Name"></DxContextMenuItem>
                <DxContextMenuItem Text="Size"></DxContextMenuItem>
                <DxContextMenuItem Text="Type"></DxContextMenuItem>
            </Items>
        </DxContextMenuItem>
        <DxContextMenuItem Text="Copy" IconUrl="images/Copy.svg" BeginGroup="true"></DxContextMenuItem>
        <DxContextMenuItem Text="Cut" IconUrl="images/Cut.svg"></DxContextMenuItem>
        <DxContextMenuItem Text="Remove" IconUrl="images/Clear.svg"></DxContextMenuItem>
        <DxContextMenuItem Text="Select All" BeginGroup="true"></DxContextMenuItem>
    </Items>
</DxContextMenu>

@code {
    string ClickedItem { get; set; }

    void OnItemClick(ContextMenuItemClickEventArgs args) {
        ClickedItem = args.ItemInfo.Text;
        InvokeAsync(StateHasChanged);
    }
}

ContextMenu clicked item

You can also specify individual click handlers for individual menu items. For a bound Context Menu, use the ClickExpression property. For unbound menu, handle the Click event.

Inheritance

Object
EventArgs
ContextMenuItemClickEventArgs
See Also