Xceed Toolkit for .NET Maui v2.0 Documentation
Xceed.Maui.Toolkit Assembly / Xceed.Maui.Toolkit Namespace / ToggleSwitch Class
Members Example


In This Topic
    ToggleSwitch Class
    In This Topic
    This control is similar to MAUI Framework's Switch control, but is more flexible than said control since, for example, it is possible to modify the ToggleSwitch's size & style, as well as set different Content & thumb for both the Checked & Unchecked state. Xceed's ToggleSwitch also allows to set which side of the Control is the Checked side & offers two ways to move the thumb from one state to the other: by click & dragging the thumb or by simply clicking on the Checked/Unchecked area.
    Syntax
    'Usage
     
    
    Dim instance As ToggleSwitch
    Example

    The following code would display this control:

    <xctk:ToggleSwitch IsChecked="True"
                       IsCheckedLeft="False"
                       CheckedBackground="Red"
                       Background="Pink"
                       CheckedContent="ON"
                       UncheckedContent="OFF"
                       HorizontalOptions="Center"
                       BorderBrush="Orange"
                       BorderThickness="4"
                       CornerRadius="15"
                       WidthRequest="150"
                       HeightRequest="40"/>
    Inheritance Hierarchy

    System.Object
       Microsoft.Maui.Controls.BindableObject
          Microsoft.Maui.Controls.Element
             Microsoft.Maui.Controls.NavigableElement
                Microsoft.Maui.Controls.VisualElement
                   Microsoft.Maui.Controls.View
                      Microsoft.Maui.Controls.Compatibility.Layout
                         Microsoft.Maui.Controls.TemplatedView
                            Xceed.Maui.Toolkit.Control
                               Xceed.Maui.Toolkit.ToggleSwitch

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also