<ui:Page
    x:Class="ModernWpf.SampleApp.ControlPages.ToggleSwitchPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ui="http://schemas.modernwpf.com/2019"
    xmlns:sc="clr-namespace:SamplesCommon;assembly=SamplesCommon"
    mc:Ignorable="d">

    <ScrollViewer>
        <ui:SimpleStackPanel Style="{StaticResource ControlPageContentPanelStyle}">
            <sc:ControlExample HeaderText="A simple ToggleSwitch.">
                <ui:ToggleSwitch AutomationProperties.Name="simple ToggleSwitch" />
            </sc:ControlExample>

            <sc:ControlExample HeaderText="A ToggleSwitch with custom header and content.">
                <StackPanel
                    Orientation="Horizontal"
                    VerticalAlignment="Top">
                    <ui:ToggleSwitch
                        x:Name="toggleSwitch"
                        Header="Toggle work"
                        OffContent="Do work"
                        OnContent="Working"
                        IsOn="True" />
                    <ui:ProgressRing
                        IsActive="{Binding IsOn, ElementName=toggleSwitch}"
                        Width="130" />
                </StackPanel>

                <sc:ControlExample.Options>
                    <ui:SimpleStackPanel Style="{StaticResource OptionsPanelStyle}">
                        <CheckBox
                            Content="IsOn"
                            IsChecked="{Binding ElementName=toggleSwitch, Path=IsOn}" />
                        <TextBox
                            ui:ControlHelper.Header="Header"
                            Text="{Binding ElementName=toggleSwitch, Path=Header, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBox
                            ui:ControlHelper.Header="OnContent"
                            Text="{Binding ElementName=toggleSwitch, Path=OnContent, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBox
                            ui:ControlHelper.Header="OffContent"
                            Text="{Binding ElementName=toggleSwitch, Path=OffContent, UpdateSourceTrigger=PropertyChanged}" />
                    </ui:SimpleStackPanel>
                </sc:ControlExample.Options>
            </sc:ControlExample>
        </ui:SimpleStackPanel>
    </ScrollViewer>
</ui:Page>
