Search results

Overview

You can define the native event using on event attribute in component. The value of attribute is treated as an event handler. The event specific data will be available in event arguments.

The different event argument types for each event are,

  • Focus Events - UIFocusEventArgs
  • Mouse Events - UIMouseEventArgs
  • Keyboard Events - UIKeyboardEventArgs
  • Touch Events – UITouchEventArgs

List of Native events supported

We have provided the following native event support to the Switch component:

List of Native events
onfocus onfocusout onfocusin onkeydown onkeyup Onkeypress

How to bind focus event to Switch

The onfocus attribute is used to bind the focus event for Switch. Here, we have explained about the sample code snippets.

@using Syncfusion.EJ2.Blazor.Buttons

<label>onfocus</label>
<EjsSwitch @onfocus="onFocus"></EjsSwitch>

@code {

    private void onFocus(Microsoft.AspNetCore.Components.Web.FocusEventArgs args)
    {
       //onfocus Event triggered
    }
}