Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxMenu.ItemClick Event

Fires when a user clicks a menu item.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[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.

Razor
<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