DxSplitButton.ItemClick Event
Fires when a user clicks a drop-down list item.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public EventCallback<DropDownButtonItemClickEventArgs> ItemClick { get; set; }
Event Data
The ItemClick event's data class is DropDownButtonItemClickEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
ItemInfo | Returns information about the clicked drop-down list item. |
MouseEventArgs | The Blazor’s built-in MouseEventArgs event arguments. |
Remarks
Use the ItemClick
event to specify a common click handler for all drop-down list items. To react to an individual item click, handle the item’s Click event.
@inject IJSRuntime JSRuntime
<p>The clicked item is @ClickedItem</p>
<DxSplitButton RenderStyle="ButtonRenderStyle.Secondary"
Text="Clipboard"
IconCssClass="tb-icon tb-icon-paste"
CssClass="me-1"
ItemClick="@OnItemCommonClick">
<Items>
<DxDropDownButtonItem Text="Cut"
IconCssClass="menu-icon-cut menu-icon"
Click="@OnCutItemClick" />
<DxDropDownButtonItem Text="Copy"
IconCssClass="menu-icon-copy menu-icon"
Click="@OnCopyItemClick" />
<DxDropDownButtonItem Text="Paste"
IconCssClass="tb-icon tb-icon-paste" />
</Items>
</DxSplitButton>
@code {
public string ClickedItem { get; set; } = "";
void OnCutItemClick(MouseEventArgs args) {
ClickedItem = "Cut";
}
void OnCopyItemClick(MouseEventArgs args) {
ClickedItem = "Copy";
}
async Task OnItemCommonClick(DropDownButtonItemClickEventArgs args) {
await JSRuntime.InvokeVoidAsync("alert", $"The drop-down button item has been clicked.");
}
}
See Also