Articles in this section
Category / Section

How to add different states in the .NET MAUI Switch control (SfSwitch)?

2 mins read

This article explains how to add different states in the .NET MAUI Switch control.

On State:

To switch to the On state, tap the switch button or set the value to true.

XAML:

<syncfusion:SfSwitch IsOn="True" />

Output:

net-maui-switch-state-on.png

Off State:

The default state is Off, which can be toggled by tapping the switch button or setting the value to false.

XAML:

<syncfusion:SfSwitch IsOn="False" />

Output:

net-maui-switch-state-off.png

Indeterminate State:

To display work progress, enable the indeterminate state using the AllowIndeterminateState property. Set the IsOn property to null to load the switch in an indeterminate state.

XAML:

<syncfusion:SfSwitch IsOn="{x:Null}" AllowIndeterminateState="True" />

Output:

net-maui-switch-indeterminate.png

Disabled On:

Switch to the disabled On state by setting IsOn to true and IsEnabled to false.

XAML:

<syncfusion:SfSwitch IsOn="True" IsEnabled="False" />

Output:

net-maui-switch-disabled-on.png

Disabled Off:

Switch to the disabled Off state by setting IsOn to false and IsEnabled to false.

XAML:

<syncfusion:SfSwitch IsOn="False" IsEnabled="False" />

Output:

net-maui-switch-disabled-off.png

Disabled Indeterminate:

Enable the disabled indeterminate state to show progress by setting IsOn to null and IsEnabled to false.

XAML:

<syncfusion:SfSwitch AllowIndeterminateState="True" IsOn="{x:Null}" IsEnabled="False"/>

Output:

net-maui-switch-disabled-indeterminate.png

Conclusion

Hope you enjoyed learning how to add different states in the .NET MAUI Switch control.

Refer to our .NET MAUI Switch feature tour page to learn about its other groundbreaking feature representations. You can explore our .NET MAUI Switch documentation to understand how to present and manipulate data.

For current customers, check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our .NET MAUI Switch and other .NET MAUI components.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied