Search results

Change Toggle Switch Button state using toggle method in Blazor Toggle Switch Button component

This section explains about how to toggle between the Toggle Switch Button states using Toggle method.

@using Syncfusion.Blazor.Buttons

<SfSwitch @bind-Checked="isChecked" OffLabel="OFF" OnLabel="ON" Created="create" @ref="SwitchObj" TChecked="bool"></SfSwitch>

@code{
    private bool isChecked = false;
    SfSwitch<bool> SwitchObj;
    private void create(object obj)
    {
        //SwitchObj.Toggle();
    }
}

Output be like

Switch Sample

Switch triggers OnChange event on every state stage to perform custom operations.