Skip to main content
All docs
V24.1

ToggleSwitch.CornerRadius Property

Gets or sets the ToggleSwitch’s corner radius. This is a dependency property.

Namespace: DevExpress.Xpf.Editors

Assembly: DevExpress.Xpf.Core.v24.1.dll

NuGet Package: DevExpress.Wpf.Core

Declaration

public CornerRadius CornerRadius { get; set; }

Property Value

Type Description
CornerRadius

The ToggleSwitch’s corner radius.

Remarks

The following code sample specifies the CornerRadius, UndefinedStateContent, EditorAppearanceProperties.FocusedBorderBrush, EditorAppearanceProperties.CheckedStateBackground, and EditorAppearanceProperties.CheckedStateBorderBrush properties.

<Window ...
    xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors">
    <StackPanel>
        <dxe:ToggleSwitch Margin="5" BorderThickness="2" BorderBrush="#FF757575" 
                          Background="White" CornerRadius="10"
                          ToggleSwitchHeight="20" ToggleSwitchWidth="45"
                          HorizontalAlignment="Left" ContentPlacement="Far"
                          CheckedStateContent="On" UncheckedStateContent="Off"
                          IsThreeState="True" UndefinedStateContent="Null"
                          dxe:EditorAppearanceProperties.FocusedBorderBrush="#FF6200EE"
                          dxe:EditorAppearanceProperties.CheckedStateBackground="#FF6200EE"
                          dxe:EditorAppearanceProperties.CheckedStateBorderBrush="#FF6200EE">>
            <dxe:ToggleSwitch.SwitchThumbTemplate>
                <DataTemplate>
                    <Grid>
                        <Ellipse Width="12" Height="12" Margin="5,4" Fill="#FF757575" x:Name="ellipse" />
                    </Grid>
                    <DataTemplate.Triggers>
                        <DataTrigger Binding="{Binding Path=IsChecked, RelativeSource={RelativeSource AncestorType=dxe:ToggleSwitch}}"
                                                 Value="True">
                            <Setter Property="Fill"
                                                TargetName="ellipse" Value="PaleGoldenrod" />
                        </DataTrigger>
                    </DataTemplate.Triggers>
                </DataTemplate>
            </dxe:ToggleSwitch.SwitchThumbTemplate>
        </dxe:ToggleSwitch>
    </StackPanel>
</Window>

ToggleSwitch - Appearance Properties

Note

The property is supported in the following DevExpress themes:

Theme Family Themes
Windows 11 Dark, Light
Windows 10 Dark, Light
Office 2019 Black, Colorful, Dark Gray, White, HighContrast
Visual Studio 2019 Blue, Dark, Light
Office 2016 SE Black, Colorful, Dark Gray, White
Visual Studio 2017 Blue, Dark, Light
See Also