blazor-devexpress-dot-blazor-dot-dxbuttonbase-ccca0f8f.md
Executes when the button is clicked.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
[Parameter]
public EventCallback<MouseEventArgs> Click { get; set; }
The Click event's data class is MouseEventArgs.
Handle this event to respond to button click.
<p>Likes: @likes</p>
<DxButton Click="Like" Text="Like" />
@code {
int likes;
protected override void OnInitialized()
{
likes = 1;
}
void Like(MouseEventArgs args)
{
likes++;
}
}
<p>Likes: @likes</p>
<DxButton Click="LikeAsync" Text="Like" />
@code {
int likes;
protected override void OnInitialized()
{
likes = 1;
}
async Task LikeAsync(MouseEventArgs args)
{
await Task.Delay(1000); // Simulate a 1-second delay
likes++;
}
}
To use the button to submit a form, set the SubmitFormOnClick option to true.
Run Demo: Button — Custom Content
See Also