Search results

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

03 Aug 2021 / 1 minute to read

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

Copied to clipboard
@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.