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