<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style x:Key="ToggleSwitch"
           TargetType="CheckBox">
        <Setter Property="Height"
                Value="15" />
        <Setter Property="ToolTipService.ShowOnDisabled"
                Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CheckBox">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="OnChecking">
                            <DoubleAnimation Storyboard.TargetName="MySlider"
                                             Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)"
                                             Duration="00:00:00.25"
                                             From="0"
                                             To="25.5" />
                            <ColorAnimation Duration="00:00:00.25"
                                            Storyboard.TargetName="MySliderBackground"
                                            Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
                                            To="{StaticResource Color.LoadingDot.Primary}" />
                        </Storyboard>
                        <Storyboard x:Key="OnUnchecking">
                            <DoubleAnimation Storyboard.TargetName="MySlider"
                                             Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)"
                                             Duration="00:00:00.25"
                                             From="25.5"
                                             To="0" />
                            <ColorAnimation Duration="00:00:00.25"
                                            Storyboard.TargetName="MySliderBackground"
                                            Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
                                            From="{StaticResource Color.LoadingDot.Primary}" />
                        </Storyboard>
                    </ControlTemplate.Resources>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked"
                                 Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource OnChecking}"
                                                 x:Name="OnChecking_BeginStoryboard" />
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource OnUnchecking}"
                                                 x:Name="OnUnchecking_BeginStoryboard" />
                            </Trigger.ExitActions>
                            <Setter Property="Background"
                                    Value="#1F92EE" />
                        </Trigger>
                        <Trigger Property="IsChecked"
                                 Value="False">
                            <Setter Property="Background"
                                    Value="{DynamicResource Color.SoftContrast}" />
                        </Trigger>
                        <Trigger Property="IsEnabled"
                                 Value="False">
                            <Setter Property="Opacity"
                                    Value="0.7" />
                            <Setter Property="Cursor"
                                    Value="{x:Null}" />
                        </Trigger>
                    </ControlTemplate.Triggers>

                    <Viewbox 
                             ToolTip="{TemplateBinding ToolTip}"
                             ToolTipService.ShowOnDisabled="True">
                        <StackPanel Orientation="Horizontal">
                            <Border x:Name="MySliderBackground"
                                Background="{TemplateBinding Background}"
                                Width="50"
                                Height="25"
                                CornerRadius="12.5"
                                Cursor="Hand">
                                <Grid HorizontalAlignment="Left">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <Border x:Name="MySlider"
                                        Grid.Column="1">
                                        <Border.RenderTransform>
                                            <TransformGroup>
                                                <TranslateTransform X="0"
                                                                Y="0" />
                                            </TransformGroup>
                                        </Border.RenderTransform>
                                        <Ellipse Height="21.5"
                                             Width="21.5"
                                             Fill="{DynamicResource BackgroundColor.Menu.MainCategory.Hover}"
                                             DockPanel.Dock="Left"
                                             Margin="2 1.5" />
                                    </Border>
                                </Grid>
                            </Border>
                            <ContentPresenter
                                  VerticalAlignment="Center"
                                  HorizontalAlignment="Center"
                                  Margin="5,0,0,0"
                                  Content="{TemplateBinding Content}" />
                        </StackPanel>

                    </Viewbox>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>