DxMenu.ItemClick Event

Fires when a user clicks a menu item.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.2.dll

Declaration

[Parameter]
public EventCallback<MenuItemClickEventArgs> ItemClick { get; set; }

Event Data

The ItemClick event's data class is MenuItemClickEventArgs. The following properties provide information specific to this event:

Property Description
ItemInfo Returns information about a clicked menu item. Inherited from MenuItemEventArgs.
MouseEventArgs The Blazor’s built-in MouseEventArgs event arguments.

Remarks

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

<div class="card w-auto">
    <DxMenu Title="DevExpress" ItemClick="OnItemClick">
        <Items>
            <DxMenuItem Text="Products" IconCssClass="oi oi-layers"/>
            <DxMenuItem Text="Support" IconCssClass="oi oi-person" />
            <DxMenuItem Text="Documentation" IconCssClass="oi oi-book" />
            <DxMenuItem Text="Demos" IconCssClass="oi oi-monitor" />
            <DxMenuItem Text="Blogs" IconCssClass="oi oi-bell" />
            <DxMenuItem Text="Search" IconCssClass="oi oi-magnifying-glass" />
        </Items>
    </DxMenu>
</div>

@ClickedMenuItem

@code  {
    public string ClickedMenuItem { get; set; } = "";

    void OnItemClick(MenuItemClickEventArgs e)
    {
        ClickedMenuItem = $"The '{e.ItemInfo.Text}' item has been clicked";
    }
}
See Also