You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -13,10 +14,10 @@ This section provides information about the events available in the .NET MAUI Sw
13
14
14
15
## StateChanged event
15
16
16
-
The StateChanged event occurs when the value or state of [`IsOn`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSwitch.html#Syncfusion_Maui_Buttons_SfSwitch_IsOn) property is changed by tapping the switch button or setting a value to [`IsOn`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSwitch.html#Syncfusion_Maui_Buttons_SfSwitch_IsOn) property. The [`SwitchStateChangedEventArgs`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangedEventArgs.html) provides the following properties:
17
+
The StateChanged event occurs when the value or state of [IsOn](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSwitch.html#Syncfusion_Maui_Buttons_SfSwitch_IsOn) property is changed by tapping the .NET MAUI Switch button or setting a value to `IsOn` property. The [SwitchStateChangedEventArgs](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangedEventArgs.html) provides the following properties:
17
18
18
-
*[`NewValue`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangedEventArgs.html#Syncfusion_Maui_Buttons_SwitchStateChangedEventArgs_NewValue) : Gets the current value of the Switch control.
19
-
*[`OldValue`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangedEventArgs.html#Syncfusion_Maui_Buttons_SwitchStateChangedEventArgs_OldValue) : Gets the previous value of the Switch control.
19
+
*[NewValue](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangedEventArgs.html#Syncfusion_Maui_Buttons_SwitchStateChangedEventArgs_NewValue) : Gets the current value of the .NET MAUI Switch control.
20
+
*[OldValue](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangedEventArgs.html#Syncfusion_Maui_Buttons_SwitchStateChangedEventArgs_OldValue) : Gets the previous value of the .NET MAUI Switch control.
The StateChanging event occurs when the state of [`IsOn`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSwitch.html#Syncfusion_Maui_Buttons_SfSwitch_IsOn) property is about to change in the Switch control. The [`SwitchStateChangingEventArgs`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangingEventArgs.html) provides the following properties:
61
+
The StateChanging event occurs when the state of [IsOn](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSwitch.html#Syncfusion_Maui_Buttons_SfSwitch_IsOn) property is about to change in the .NET MAUI Switch control. The [SwitchStateChangingEventArgs](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangingEventArgs.html) provides the following properties:
61
62
62
-
*[`NewValue`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangingEventArgs.html#Syncfusion_Maui_Buttons_SwitchStateChangingEventArgs_NewValue) : Gets the current value of the Switch control.
63
-
*[`OldValue`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangingEventArgs.html#Syncfusion_Maui_Buttons_SwitchStateChangingEventArgs_OldValue) : Gets the previous value of the Switch control.
63
+
*[NewValue](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangingEventArgs.html#Syncfusion_Maui_Buttons_SwitchStateChangingEventArgs_NewValue) : Gets the current value of the .NET MAUI Switch control.
64
+
*[OldValue](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangingEventArgs.html#Syncfusion_Maui_Buttons_SwitchStateChangingEventArgs_OldValue) : Gets the previous value of the .NET MAUI Switch control.
64
65
*`Cancel` : Gets or sets a value indicating whether the event should be canceled.
# Getting Started with .NET MAUI Switch (SfSwitch)
@@ -13,7 +14,7 @@ This section explains the steps to configure the .NET MAUI Switch control in a r
13
14
14
15
## Adding a .NET MAUI Switch reference
15
16
16
-
The Syncfusion .NET MAUI controls are available in [Nuget.org](https://www.nuget.org/). To add [`.NET MAUI Switch`](https://www.syncfusion.com/maui-controls/maui-switch) to your project, open the NuGet package manager in Visual Studio, search for [`Syncfusion.Maui.Buttons`](https://www.nuget.org/packages/Syncfusion.Maui.Buttons), and install it.
17
+
The Syncfusion .NET MAUI controls are available in [Nuget.org](https://www.nuget.org/). To add [.NET MAUI Switch](https://www.syncfusion.com/maui-controls/maui-switch) to your project, open the NuGet package manager in Visual Studio, search for [Syncfusion.Maui.Buttons](https://www.nuget.org/packages/Syncfusion.Maui.Buttons), and install it.
17
18
18
19
## Handler registration
19
20
@@ -53,7 +54,7 @@ namespace SwitchSample
53
54
54
55
Step 1: Add the NuGet to the project as discussed in the above reference section.
55
56
56
-
Step 2: Add the namespace as shown in the following code sample.
57
+
Step 2: Add the namespace as shown in the following code sample, to initialize the .NET MAUI Switch control.
57
58
58
59
{% tabs %}
59
60
{% highlight xaml %}
@@ -70,7 +71,7 @@ Step 2: Add the namespace as shown in the following code sample.
70
71
71
72
## Initialize Switch
72
73
73
-
Now, add the [`SfSwitch`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSwitch.html) control with a required optimal name using the included namespace.
74
+
Now, add the [SfSwitch](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SfSwitch.html) control with a required optimal name using the included namespace.
74
75
75
76
{% tabs %}
76
77
@@ -93,9 +94,9 @@ this.Content = sfSwitch;
93
94
94
95
## Performing an action based on state
95
96
96
-
You can switch between the states. When the state is changed the [`StateChanging`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangingEventArgs.html) and [`StateChanged`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangedEventArgs.html)event will be triggered where you can perform an action based on the current state. The [`StateChanging`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangingEventArgs.html) event allows you to cancel moving to a new state.
97
+
You can switch between states in the .NET MAUI Switch control. When the state changes, the [StateChanging](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangingEventArgs.html) and [StateChanged](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangedEventArgs.html)events are triggered, allowing you to perform actions based on the current state. The [StateChanging](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchStateChangingEventArgs.html) event also provides the option to cancel the transition to a new state.
97
98
98
-
The following code example displays a message box when switched to off state when work is completed.
99
+
The following code example displays a message box when the .NET MAUI Switch is switched to the off state after the work is completed.
SfSwitch supports changing the layout direction of the control in the right-to-left direction by setting the FlowDirection to RightToLeft or by changing the device language.
13
+
The .NET MAUI Switch supports changing the layout direction of the control in the right-to-left direction by setting the `FlowDirection` to RightToLeft or by changing the device language.
The switch control provides options to customize the color based on the states. The following code example demonstrates how to customize the switch control.
13
+
The .NET MAUI Switch control provides options to customize the color based on its states. The following code example demonstrates how to customize the .NET MAUI Switch control.
13
14
14
15
## Colors
15
16
16
17
The following properties are used to apply solid colors to the thumb, track, and border, respectively:
17
18
18
-
*[`TrackBackground`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_TrackBackground): Represents the color for the track.
19
-
*[`ThumbBackground`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_ThumbBackground): Represents the color for the thumb.
20
-
*[`TrackStroke`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_TrackStroke): Represents the color for the border of the track.
21
-
*[`ThumbStroke`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_ThumbStroke): Represents the border color for the thumb.
19
+
*[TrackBackground](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_TrackBackground): Represents the color for the track.
20
+
*[ThumbBackground](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_ThumbBackground): Represents the color for the thumb.
21
+
*[TrackStroke](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_TrackStroke): Represents the color for the border of the track.
22
+
*[ThumbStroke](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_ThumbStroke): Represents the border color for the thumb.
22
23
23
24
{% tabs %}
24
25
@@ -121,18 +122,18 @@ this.Content = sfSwitch;
121
122
122
123
## Sizing
123
124
124
-
In the switch control, sizing of the thumb and the track can be controlled by using the following properties:
125
+
In the .NET MAUI Switch control, sizing of the thumb and the track can be controlled by using the following properties:
125
126
126
-
*[`TrackCornerRadius`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_TrackCornerRadius): Represents a CornerRadius value to create curved corner of the track.
127
-
*[`TrackStrokeThickness`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_TrackStrokeThickness): Represents a double value for defining the track border width.
128
-
*[`TrackWidthRequest`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_TrackWidthRequest): Represents a double value for defining the track width.
129
-
*[`TrackHeightRequest`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_TrackHeightRequest): Represents double value for defining the track height.
130
-
*[`ThumbCornerRadius`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_ThumbCornerRadius): Represents a CornerRadius value to create curved corner of the thumb.
131
-
*[`ThumbStrokeThickness`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_ThumbStrokeThickness): Represents a double value for defining the thumb border width.
132
-
*[`ThumbWidthRequest`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_ThumbWidthRequest): Represents double value for defining the thumb width.
133
-
*[`ThumbHeightRequest`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_ThumbHeightRequest): Represents double value for defining the thumb height.
127
+
*[TrackCornerRadius](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_TrackCornerRadius): Represents a CornerRadius value to create curved corner of the track.
128
+
*[TrackStrokeThickness](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_TrackStrokeThickness): Represents a double value for defining the track border width.
129
+
*[TrackWidthRequest](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_TrackWidthRequest): Represents a double value for defining the track width.
130
+
*[TrackHeightRequest](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_TrackHeightRequest): Represents double value for defining the track height.
131
+
*[ThumbCornerRadius](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_ThumbCornerRadius): Represents a CornerRadius value to create curved corner of the thumb.
132
+
*[ThumbStrokeThickness](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_ThumbStrokeThickness): Represents a double value for defining the thumb border width.
133
+
*[ThumbWidthRequest](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_ThumbWidthRequest): Represents double value for defining the thumb width.
134
+
*[ThumbHeightRequest](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_ThumbHeightRequest): Represents double value for defining the thumb height.
134
135
135
-
The following code example demonstrates how to customize the size of the track and thumb.
136
+
The following code example demonstrates how to customize the size of the track and thumb in a .NET MAUI Switch.
136
137
137
138
{% tabs %}
138
139
@@ -228,10 +229,10 @@ this.Content = sfSwitch;
228
229
229
230
## Custom Path
230
231
231
-
In the switch control, customize the thumb's icon by using the following properties:
232
+
In the .NET MAUI Switch control, customize the thumb's icon by using the following properties:
232
233
233
-
*[`CustomPath`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_CustomPath): Represents a Path value for defining the thumb's icon.
234
-
*[`IconColor`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_IconColor): Represents the color for the thumb's icon.
234
+
*[CustomPath](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_CustomPath): Represents a Path value for defining the thumb's icon.
235
+
*[IconColor](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Buttons.SwitchSettings.html#Syncfusion_Maui_Buttons_SwitchSettings_IconColor): Represents the color for the thumb's icon.
0 commit comments