Skip to main content
All docs
V25.1
  • ToggleSwitch.UndefinedStateContent Property

    Gets or sets the content that is displayed when the toggle switch is in the undefined state. This is a dependency property.

    Namespace: DevExpress.Xpf.Editors

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

    NuGet Package: DevExpress.Wpf.Core

    Declaration

    public object UndefinedStateContent { get; set; }

    Property Value

    Type Description
    Object

    The content of the toggle switch.

    Remarks

    The ToggleSwitch displays the UndefinedStateContent only when the IsThreeState is true.

    The following code sample specifies the UndefinedStateContent, CornerRadius, 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" UncheckedState Content="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