Class SplitButtonEvents
Specifies the event callbacks that can be configured for the SfSplitButton component.
Inheritance
Namespace: Syncfusion.Blazor.SplitButtons
Assembly: Syncfusion.Blazor.dll
Syntax
public class SplitButtonEvents : ComponentBase
Remarks
This component is nested within the SfSplitButton and is used to handle various events, such as item selection, opening, and closing of the popup menu.
Constructors
SplitButtonEvents()
Declaration
public SplitButtonEvents()
Properties
Clicked
Gets or sets an event callback that is raised when the primary button of the SfSplitButton is clicked.
Declaration
public EventCallback<ClickEventArgs> Clicked { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<ClickEventArgs> | An Microsoft.AspNetCore.Components.EventCallback<> that is invoked when the primary button is clicked. The callback receives a ClickEventArgs argument. |
Remarks
This event is triggered only when the main part of the split button is clicked, not when the dropdown arrow is clicked.
Examples
<SfSplitButton Content="Save">
<DropDownMenuItems>
<DropDownMenuItem Text="Save as..."></DropDownMenuItem>
<DropDownMenuItem Text="Save and Print"></DropDownMenuItem>
</DropDownMenuItems>
<SplitButtonEvents Clicked="@PrimaryButtonClicked"></SplitButtonEvents>
</SfSplitButton>
@code {
private void PrimaryButtonClicked(ClickEventArgs args) {
// Handle the primary button click here.
}
}
Closed
Gets or sets an event callback that is raised after the SfSplitButton popup is closed.
Declaration
public EventCallback<OpenCloseMenuEventArgs> Closed { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<OpenCloseMenuEventArgs> | An Microsoft.AspNetCore.Components.EventCallback<> that is invoked after the popup is closed. The callback receives an OpenCloseMenuEventArgs argument. |
Remarks
This event is specified within the SplitButtonEvents tag directive. You can access details about the closed popup via the OpenCloseMenuEventArgs.
Examples
<SfSplitButton>
<DropDownMenuItems>
<DropDownMenuItem Text="Dashboard"></DropDownMenuItem>
<DropDownMenuItem Text="Notifications"></DropDownMenuItem>
<DropDownMenuItem Text="User Settings"></DropDownMenuItem>
<DropDownMenuItem Text="Log Out"></DropDownMenuItem>
</DropDownMenuItems>
<SplitButtonEvents Closed="@Closed"></SplitButtonEvents>
</SfSplitButton>
@code {
private void Closed(OpenCloseMenuEventArgs args) {
// Write your code here.
}
}
Created
Gets or sets an event callback that is raised after the SfSplitButton component is created and rendered.
Declaration
public EventCallback<object> Created { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> | An Microsoft.AspNetCore.Components.EventCallback that is invoked after the component has been created. |
Remarks
This event is triggered once the component has been initialized and rendered on the page, and it is primarily used for interoperability purposes.
Examples
<SfSplitButton>
<DropDownMenuItems>
<DropDownMenuItem Text="Dashboard"></DropDownMenuItem>
<DropDownMenuItem Text="Notifications"></DropDownMenuItem>
<DropDownMenuItem Text="User Settings"></DropDownMenuItem>
<DropDownMenuItem Text="Log Out"></DropDownMenuItem>
</DropDownMenuItems>
<SplitButtonEvents Created="@Created"></SplitButtonEvents>
</SfSplitButton>
@code {
private void Created() {
// Write your code here.
}
}
ItemSelected
Gets or sets an event callback that is raised when an item in the SfSplitButton's dropdown menu is selected.
Declaration
public EventCallback<MenuEventArgs> ItemSelected { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<MenuEventArgs> | An Microsoft.AspNetCore.Components.EventCallback<> that is invoked when an item is selected. The callback receives a MenuEventArgs argument. |
Remarks
The event is specified within the SplitButtonEvents tag directive. You can access details of the selected item using the MenuEventArgs.
Examples
<SfSplitButton>
<DropDownMenuItems>
<DropDownMenuItem Text="Dashboard"></DropDownMenuItem>
<DropDownMenuItem Text="Notifications"></DropDownMenuItem>
<DropDownMenuItem Text="User Settings"></DropDownMenuItem>
<DropDownMenuItem Text="Log Out"></DropDownMenuItem>
</DropDownMenuItems>
<SplitButtonEvents ItemSelected="@ItemSelected"></SplitButtonEvents>
</SfSplitButton>
@code {
private void ItemSelected(MenuEventArgs args) {
// Write your code here.
}
}
OnClose
Gets or sets an event callback that is raised before the SfSplitButton popup is closing.
Declaration
public EventCallback<BeforeOpenCloseMenuEventArgs> OnClose { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<BeforeOpenCloseMenuEventArgs> | An Microsoft.AspNetCore.Components.EventCallback<> that is invoked before the popup closes. The callback receives a BeforeOpenCloseMenuEventArgs argument. |
Remarks
This event can be used to perform actions or to prevent the popup from closing by setting the Cancel property to true
.
The event is specified within the SplitButtonEvents tag directive.
Examples
<SfSplitButton>
<DropDownMenuItems>
<DropDownMenuItem Text="Dashboard"></DropDownMenuItem>
<DropDownMenuItem Text="Notifications"></DropDownMenuItem>
<DropDownMenuItem Text="User Settings"></DropDownMenuItem>
<DropDownMenuItem Text="Log Out"></DropDownMenuItem>
</DropDownMenuItems>
<SplitButtonEvents OnClose="@OnClose"></SplitButtonEvents>
</SfSplitButton>
@code {
private void OnClose(BeforeOpenCloseMenuEventArgs args) {
// Write your code here.
}
}
OnItemRender
Gets or sets an event callback that is raised before each item in the SfSplitButton dropdown menu is rendered.
Declaration
public EventCallback<MenuEventArgs> OnItemRender { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<MenuEventArgs> | An Microsoft.AspNetCore.Components.EventCallback<> that is invoked before each item is rendered. The callback receives a MenuEventArgs argument. |
Remarks
This event allows for customization of the Split Button items as they are rendered. The event is specified within the SplitButtonEvents tag directive.
Examples
<SfSplitButton>
<DropDownMenuItems>
<DropDownMenuItem Text="Dashboard"></DropDownMenuItem>
<DropDownMenuItem Text="Notifications"></DropDownMenuItem>
<DropDownMenuItem Text="User Settings"></DropDownMenuItem>
<DropDownMenuItem Text="Log Out"></DropDownMenuItem>
</DropDownMenuItems>
<SplitButtonEvents OnItemRender="@OnItemRender"></SplitButtonEvents>
</SfSplitButton>
@code {
private void OnItemRender(MenuEventArgs args) {
// Write your code here.
}
}
OnOpen
Gets or sets an event callback that is raised before the SfSplitButton popup is opening.
Declaration
public EventCallback<BeforeOpenCloseMenuEventArgs> OnOpen { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<BeforeOpenCloseMenuEventArgs> | An Microsoft.AspNetCore.Components.EventCallback<> that is invoked before the popup opens. The callback receives a BeforeOpenCloseMenuEventArgs argument. |
Remarks
This event can be used to perform actions or to prevent the popup from opening by setting the Cancel property to true
.
The event is specified within the SplitButtonEvents tag directive.
Examples
<SfSplitButton>
<DropDownMenuItems>
<DropDownMenuItem Text="Dashboard"></DropDownMenuItem>
<DropDownMenuItem Text="Notifications"></DropDownMenuItem>
<DropDownMenuItem Text="User Settings"></DropDownMenuItem>
<DropDownMenuItem Text="Log Out"></DropDownMenuItem>
</DropDownMenuItems>
<SplitButtonEvents OnOpen="@OnOpen"></SplitButtonEvents>
</SfSplitButton>
@code {
private void OnOpen(BeforeOpenCloseMenuEventArgs args) {
// Write your code here.
}
}
Opened
Gets or sets an event callback that is raised after the SfSplitButton popup is opened.
Declaration
public EventCallback<OpenCloseMenuEventArgs> Opened { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<OpenCloseMenuEventArgs> | An Microsoft.AspNetCore.Components.EventCallback<> that is invoked after the popup is opened. The callback receives an OpenCloseMenuEventArgs argument. |
Remarks
The event is specified within the SplitButtonEvents tag directive. You can access details about the opened popup via the OpenCloseMenuEventArgs.
Examples
<SfSplitButton>
<DropDownMenuItems>
<DropDownMenuItem Text="Dashboard"></DropDownMenuItem>
<DropDownMenuItem Text="Notifications"></DropDownMenuItem>
<DropDownMenuItem Text="User Settings"></DropDownMenuItem>
<DropDownMenuItem Text="Log Out"></DropDownMenuItem>
</DropDownMenuItems>
<SplitButtonEvents Opened="@Opened"></SplitButtonEvents>
</SfSplitButton>
@code {
private void Opened(OpenCloseMenuEventArgs args) {
// Write your code here.
}
}
Methods
OnInitializedAsync()
A protected method that is called when the component is first initialized.
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
This method assigns the current instance of SplitButtonEvents to the parent SfSplitButton's Delegates property.