Implementing Syncfusion .NET MAUI Switch (SfSwitch)
The Syncfusion .NET MAUI Switch (SfSwitch) control provides an efficient way to toggle between states with rich customization options, multiple state support, and advanced visual styling capabilities.
When to Use This Skill
Use this skill when you need to:
- Implement toggle switches or on/off controls in .NET MAUI applications
- Create binary state controls with visual feedback
- Implement indeterminate states for work-in-progress scenarios
- Customize switch appearance (colors, sizes, corner radius, borders)
- Add custom icons or paths inside the switch thumb
- Handle state change events with validation or cancellation logic
- Apply advanced styling using Visual State Manager
- Support right-to-left (RTL) layouts for internationalization
- Implement modern UI effects like liquid glass morphism
- Provide accessible toggle controls with visual state feedback
Component Overview
The SfSwitch control offers:
- Multiple States: On, Off, Indeterminate, and their disabled variants
- Rich Customization: Colors, sizes, borders, corner radius, and custom icons
- Event Handling: StateChanged and StateChanging events with cancellation support
- Visual State Manager: Advanced state-based styling for hovered, pressed, and disabled states
- Modern Features: Liquid glass effect for premium UI experiences
- RTL Support: Bidirectional layout support for global applications
- Theming: Material, Cupertino, and Fluent design themes
Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md
Use this when you need to:
- Install the Syncfusion.Maui.Buttons NuGet package
- Register the handler with ConfigureSyncfusionCore
- Create your first basic switch implementation
- Set up switch in both XAML and C#
- Perform actions based on state changes
Switch States
📄 Read: references/switch-states.md
Use this when you need to:
- Understand all available switch states
- Implement On, Off, and default states
- Enable and use indeterminate state (IsOn = null)
- Create disabled state variants (disabled On/Off/Indeterminate)
- Control state transitions programmatically
- Set initial state values
Events
📄 Read: references/events.md
Use this when you need to:
- Handle state change notifications (StateChanged event)
- Validate or cancel state transitions (StateChanging event)
- Access old and new state values in event handlers
- Implement conditional state changes
- Trigger actions when switch state changes
- Prevent unwanted state transitions
Customization
📄 Read: references/customization.md
Use this when you need to:
- Customize track and thumb colors
- Adjust switch dimensions (width, height)
- Configure border colors and thickness
- Set corner radius for rounded appearance
- Add custom icons or paths to the thumb
- Apply different colors to different states
- Create branded or themed switch designs
Visual State Manager
📄 Read: references/visual-state-manager.md
Use this when you need to:
- Apply advanced state-based styling
- Customize hovered state appearance (OnHovered, OffHovered, IndeterminateHovered)
- Style pressed states (OnPressed, OffPressed, IndeterminatePressed)
- Configure disabled state visuals (OnDisabled, OffDisabled, IndeterminateDisabled)
- Implement complex visual transitions
- Create interactive hover and press effects
Advanced Features
📄 Read: references/advanced-features.md
Use this when you need to:
- Enable liquid glass effect for modern UI (EnableLiquidGlassEffect)
- Implement right-to-left (RTL) layout support
- Support bidirectional layouts for internationalization
- Apply glass morphism effects over vibrant backgrounds
- Handle platform-specific features (.NET 10+, iOS 26, macOS 26)
1---
2name: syncfusion-maui-switch
3description: Implements and customize Syncfusion .NET MAUI Switch (SfSwitch) controls. Use when working with switches, toggle switches, on/off controls, or binary state controls in .NET MAUI applications. Covers switch customization (colors, sizes, icons), state changes, indeterminate states, and visual state managers.
4metadata:
5 author: "Syncfusion Inc"
6 version: "34.1.29"
7---
8
9# Implementing Syncfusion .NET MAUI Switch (SfSwitch)
10
11The Syncfusion .NET MAUI Switch (SfSwitch) control provides an efficient way to toggle between states with rich customization options, multiple state support, and advanced visual styling capabilities.
12
13## When to Use This Skill
14
15Use this skill when you need to:
16- Implement toggle switches or on/off controls in .NET MAUI applications
17- Create binary state controls with visual feedback
18- Implement indeterminate states for work-in-progress scenarios
19- Customize switch appearance (colors, sizes, corner radius, borders)
20- Add custom icons or paths inside the switch thumb
21- Handle state change events with validation or cancellation logic
22- Apply advanced styling using Visual State Manager
23- Support right-to-left (RTL) layouts for internationalization
24- Implement modern UI effects like liquid glass morphism
25- Provide accessible toggle controls with visual state feedback
26
27## Component Overview
28
29The SfSwitch control offers:
30- **Multiple States:** On, Off, Indeterminate, and their disabled variants
31- **Rich Customization:** Colors, sizes, borders, corner radius, and custom icons
32- **Event Handling:** StateChanged and StateChanging events with cancellation support
33- **Visual State Manager:** Advanced state-based styling for hovered, pressed, and disabled states
34- **Modern Features:** Liquid glass effect for premium UI experiences
35- **RTL Support:** Bidirectional layout support for global applications
36- **Theming:** Material, Cupertino, and Fluent design themes
37
38## Documentation and Navigation Guide
39
40### Getting Started
41📄 **Read:** [references/getting-started.md](references/getting-started.md)
42
43Use this when you need to:
44- Install the Syncfusion.Maui.Buttons NuGet package
45- Register the handler with ConfigureSyncfusionCore
46- Create your first basic switch implementation
47- Set up switch in both XAML and C#
48- Perform actions based on state changes
49
50### Switch States
51📄 **Read:** [references/switch-states.md](references/switch-states.md)
52
53Use this when you need to:
54- Understand all available switch states
55- Implement On, Off, and default states
56- Enable and use indeterminate state (IsOn = null)
57- Create disabled state variants (disabled On/Off/Indeterminate)
58- Control state transitions programmatically
59- Set initial state values
60
61### Events
62📄 **Read:** [references/events.md](references/events.md)
63
64Use this when you need to:
65- Handle state change notifications (StateChanged event)
66- Validate or cancel state transitions (StateChanging event)
67- Access old and new state values in event handlers
68- Implement conditional state changes
69- Trigger actions when switch state changes
70- Prevent unwanted state transitions
71
72### Customization
73📄 **Read:** [references/customization.md](references/customization.md)
74
75Use this when you need to:
76- Customize track and thumb colors
77- Adjust switch dimensions (width, height)
78- Configure border colors and thickness
79- Set corner radius for rounded appearance
80- Add custom icons or paths to the thumb
81- Apply different colors to different states
82- Create branded or themed switch designs
83
84### Visual State Manager
85📄 **Read:** [references/visual-state-manager.md](references/visual-state-manager.md)
86
87Use this when you need to:
88- Apply advanced state-based styling
89- Customize hovered state appearance (OnHovered, OffHovered, IndeterminateHovered)
90- Style pressed states (OnPressed, OffPressed, IndeterminatePressed)
91- Configure disabled state visuals (OnDisabled, OffDisabled, IndeterminateDisabled)
92- Implement complex visual transitions
93- Create interactive hover and press effects
94
95### Advanced Features
96📄 **Read:** [references/advanced-features.md](references/advanced-features.md)
97
98Use this when you need to:
99- Enable liquid glass effect for modern UI (EnableLiquidGlassEffect)
100- Implement right-to-left (RTL) layout support
101- Support bidirectional layouts for internationalization
102- Apply glass morphism effects over vibrant backgrounds
103- Handle platform-specific features (.NET 10+, iOS 26, macOS 26)
104