Skip to content

Cupertino Toggle Switch

The Cupertino Toggle Switch mimics the look and feel of switches from iOS.

CupertinoToggleSwitch

Properties

ThumbColor - Color

Gets or sets the color of the thumb switch. Default is White.

TrackEnabledColor - Color

Gets or sets the color of the enabled track (background). Default is Green.

TrackDisabledColor - Color

Gets or sets the color of the disabled track (background). Default is Red.

BorderWidth - double

Gets or sets the border width. Default is 4d.

ToggleAnimationDuration - uint

Gets or sets the duration of the animation toggle. Default is 240u.

ToggleMaxWidth - double

Gets or sets the max width. Default is 56d.

ToggleMaxHeight - double

Gets or sets the max height. Default is 32d.

Command - ICommand

Gets or sets the command.

CommandParameter - object

Gets or sets the command parameter.

IsToggled - bool

Gets or sets a value that indicates if the switch is toggled.

Example Usage

Xaml

<aurora:CupertinoToggleSwitch x:Name="CupertinoToggleSwitch" WidthRequest="80" TrackEnabledColor="Lime" TrackDisabledColor="Red" />

C#

var toggle = new Aurora.Controls.CupertinoToggleSwitch
    {
        TrackEnabledColor = Color.Green,
        TrackDisabledColor = Color.Grey,
        ThumbColor = Color.Blue
    };

Example Styles

A switch with ThumbColor of Black and TrackEnabledColor of Blue:

Example1

var toggle = new Aurora.Controls.CupertinoToggleSwitch
    {
        TrackEnabledColor = Color.Blue,
        ThumbColor = Color.Black
    };
<aurora:CupertinoToggleSwitch x:Name="toggle" TrackEnabledColor="Blue" ThumbColor="Black" />

A switch with ThumbColor of Silver and TrackDisabledColor of Red:

Example2

var toggle = new Aurora.Controls.CupertinoToggleSwitch
    {
        TrackDisabledColor = Color.Red,
        ThumbColor = Color.Silver
    };
<aurora:CupertinoToggleSwitch x:Name="toggle" TrackDisabledColor="Red" ThumbColor="Silver" />