Blazor provides a set of event argument types that map to events. By using this event argument types we can get the event data for the specific event. For example, you need to use KeyboardEventArgs to get the event data for the keypress event in the input element for every key press.
<input type="text" @onkeypress="@KeyPressed" />
@code {
private void KeyPressed(KeyboardEventArgs args)
{
Console.WriteLine(args.Key + " was pressed");
}
}
Refer to this Visual Studio Magazine link for more events and event args.
Share with