Event binding is quite limited in Blazor. Currently, only onclick
and onchange
are supported. You can find more details in the Blazor GitHub.
@page "/event-binding"
<h3>Event Binding</h3> <br /> <br />
<button onclick=@ButtonClicked>Event Binding Example</button> <br /> <br />
<button onclick=@(() => Message = "Inline:Button Clicked")>Inline Event Binding</button> <br /> <br />
<p>Message: @Message</p>
@functions {
private string Message { get; set; } = "";
void ButtonClicked()
{
Message = "Button Clicked";
}
}