<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:icons="using:Richasy.FluentIcon.Uwp"
    xmlns:loc="using:Bili.App.Resources.Extension"
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls">

    <Thickness x:Key="NavigationViewContentMargin">0</Thickness>
    <Thickness x:Key="NavigationViewContentPresenterMargin">0</Thickness>
    <Thickness x:Key="TopNavigationViewTopNavGridMargin">0</Thickness>
    <Thickness x:Key="TopNavigationViewContentGridBorderThickness">0</Thickness>
    <SolidColorBrush x:Key="NavigationViewTopPaneBackground" Color="Transparent" />
    <SolidColorBrush x:Key="NavigationViewContentBackground" Color="Transparent" />
    <SolidColorBrush x:Key="NavigationViewExpandedPaneBackground" Color="Transparent" />
    <SolidColorBrush x:Key="TeachingTipTransientBackground" Color="{ThemeResource SolidBackgroundFillColorBase}" />

    <x:Double x:Key="TeachingTipMaxHeight">800</x:Double>
    <x:Double x:Key="TeachingTipMaxWidth">520</x:Double>

    <Style x:Key="PageProgressRingStyle" TargetType="muxc:ProgressRing">
        <Setter Property="Width" Value="32" />
        <Setter Property="Height" Value="32" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="IsActive" Value="True" />
    </Style>

    <Style TargetType="icons:RegularFluentIcon">
        <Setter Property="FontSize" Value="16" />
    </Style>

    <DataTemplate x:Key="FilterItemTemplate">
        <TextBlock Text="{Binding Value}" />
    </DataTemplate>

    <Style
        x:Key="ThinPaddingFlyoutPresenterStyle"
        BasedOn="{StaticResource DefaultFlyoutPresenterStyle}"
        TargetType="FlyoutPresenter">
        <Setter Property="Padding" Value="8" />
    </Style>

    <Style x:Key="CommandBarFlyoutCommandBarOverflowPresenterStyle" TargetType="CommandBarOverflowPresenter">
        <Setter Property="MaxHeight" Value="600" />
    </Style>

    <Style TargetType="muxc:IconSource">
        <Setter Property="Foreground" Value="{x:Null}" />
    </Style>

    <Style x:Key="TopNavigationViewStyle" TargetType="muxc:NavigationView">
        <Setter Property="IsBackButtonVisible" Value="Collapsed" />
        <Setter Property="IsPaneToggleButtonVisible" Value="False" />
        <Setter Property="IsSettingsVisible" Value="False" />
        <Setter Property="PaneDisplayMode" Value="Top" />
    </Style>

    <Style
        x:Key="XboxSideNavigationViewStyle"
        BasedOn="{StaticResource TopNavigationViewStyle}"
        TargetType="muxc:NavigationView">
        <Setter Property="PaneDisplayMode" Value="Left" />
        <Setter Property="OpenPaneLength" Value="200" />
        <Setter Property="Margin" Value="24,0,0,0" />
    </Style>

    <Style
        x:Key="DanmakuToggleSwitchStyle"
        BasedOn="{StaticResource DefaultToggleSwitchStyle}"
        TargetType="ToggleSwitch">
        <Setter Property="MinWidth" Value="0" />
        <Setter Property="MinHeight" Value="0" />
        <Setter Property="Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleSwitch">
                    <Grid
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="{TemplateBinding CornerRadius}">

                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="Stroke">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchStrokeOff}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="Fill">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchFillOff}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOff}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOn}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Fill">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchFillOn}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Stroke">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchStrokeOn}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchAreaGrid" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchContainerBackground}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOn"
                                            Storyboard.TargetProperty="Width">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlFasterAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOn"
                                            Storyboard.TargetProperty="Height">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlFasterAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOff"
                                            Storyboard.TargetProperty="Width">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlFasterAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOff"
                                            Storyboard.TargetProperty="Height">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlFasterAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="PointerOver">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                            <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchStrokeOffPointerOver}" />
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                            <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchFillOffPointerOver}" />
                                        </ColorAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOffPointerOver}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOnPointerOver}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Fill">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchFillOnPointerOver}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Stroke">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchStrokeOnPointerOver}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="SwitchAreaGrid" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
                                            <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchContainerBackgroundPointerOver}" />
                                        </ColorAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOn"
                                            Storyboard.TargetProperty="Width">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlFasterAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOn"
                                            Storyboard.TargetProperty="Height">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlFasterAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOff"
                                            Storyboard.TargetProperty="Width">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlFasterAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOff"
                                            Storyboard.TargetProperty="Height">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlFasterAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">

                                    <VisualState.Setters>
                                        <Setter Target="SwitchKnobOn.HorizontalAlignment" Value="Right" />
                                        <Setter Target="SwitchKnobOn.Margin" Value="0,0,3,0" />
                                        <Setter Target="SwitchKnobOff.HorizontalAlignment" Value="Left" />
                                        <Setter Target="SwitchKnobOff.Margin" Value="3,0,0,0" />
                                    </VisualState.Setters>

                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                            <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchStrokeOffPressed}" />
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                            <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchFillOffPressed}" />
                                        </ColorAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Fill">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchFillOnPressed}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Stroke">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchStrokeOnPressed}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOffPressed}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOnPressed}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="SwitchAreaGrid" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
                                            <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchContainerBackgroundPressed}" />
                                        </ColorAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOn"
                                            Storyboard.TargetProperty="Width">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlFasterAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOn"
                                            Storyboard.TargetProperty="Height">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlFasterAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOff"
                                            Storyboard.TargetProperty="Width">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlFasterAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOff"
                                            Storyboard.TargetProperty="Height">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlFasterAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderContentPresenter" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchHeaderForegroundDisabled}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                            <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchStrokeOffDisabled}" />
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                            <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchFillOffDisabled}" />
                                        </ColorAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Fill">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchFillOnDisabled}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Stroke">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchStrokeOnDisabled}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOffDisabled}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOnDisabled}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="SwitchAreaGrid" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
                                            <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchContainerBackgroundDisabled}" />
                                        </ColorAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOn"
                                            Storyboard.TargetProperty="Width">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlNormalAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOn"
                                            Storyboard.TargetProperty="Height">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlNormalAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOff"
                                            Storyboard.TargetProperty="Width">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlNormalAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames
                                            EnableDependentAnimation="True"
                                            Storyboard.TargetName="SwitchKnobOff"
                                            Storyboard.TargetProperty="Height">
                                            <SplineDoubleKeyFrame
                                                KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"
                                                KeyTime="{StaticResource ControlNormalAnimationDuration}"
                                                Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>

                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ToggleStates">

                                <VisualStateGroup.Transitions>
                                    <VisualTransition
                                        x:Name="DraggingToOnTransition"
                                        GeneratedDuration="0"
                                        From="Dragging"
                                        To="On">

                                        <Storyboard>
                                            <RepositionThemeAnimation FromHorizontalOffset="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.KnobCurrentToOnOffset}" TargetName="SwitchKnob" />
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Opacity">
                                                <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="Opacity">
                                                <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Opacity">
                                                <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Opacity">
                                                <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualTransition>
                                    <VisualTransition
                                        x:Name="OnToDraggingTransition"
                                        GeneratedDuration="0"
                                        From="On"
                                        To="Dragging">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Opacity">
                                                <LinearDoubleKeyFrame KeyTime="0" Value="1" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Opacity">
                                                <LinearDoubleKeyFrame KeyTime="0" Value="1" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Opacity">
                                                <LinearDoubleKeyFrame KeyTime="0" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualTransition>
                                    <VisualTransition
                                        x:Name="DraggingToOffTransition"
                                        GeneratedDuration="0"
                                        From="Dragging"
                                        To="Off">

                                        <Storyboard>
                                            <RepositionThemeAnimation FromHorizontalOffset="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.KnobCurrentToOffOffset}" TargetName="SwitchKnob" />
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Opacity">
                                                <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Opacity">
                                                <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Opacity">
                                                <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualTransition>
                                    <VisualTransition
                                        x:Name="OnToOffTransition"
                                        GeneratedDuration="0"
                                        From="On"
                                        To="Off">

                                        <Storyboard>
                                            <RepositionThemeAnimation FromHorizontalOffset="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.KnobOnToOffOffset}" TargetName="SwitchKnob" />
                                        </Storyboard>
                                    </VisualTransition>
                                    <VisualTransition
                                        x:Name="OffToOnTransition"
                                        GeneratedDuration="0"
                                        From="Off"
                                        To="On">

                                        <Storyboard>
                                            <RepositionThemeAnimation FromHorizontalOffset="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.KnobOffToOnOffset}" TargetName="SwitchKnob" />
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Opacity">
                                                <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="Opacity">
                                                <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Opacity">
                                                <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Opacity">
                                                <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualTransition>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Dragging" />
                                <VisualState x:Name="Off" />
                                <VisualState x:Name="On">
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="KnobTranslateTransform"
                                            Storyboard.TargetProperty="X"
                                            To="20"
                                            Duration="0" />
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Opacity">
                                            <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="Opacity">
                                            <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Opacity">
                                            <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Opacity">
                                            <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>

                            </VisualStateGroup>

                        </VisualStateManager.VisualStateGroups>

                        <ContentPresenter
                            x:Name="HeaderContentPresenter"
                            Grid.Row="0"
                            Margin="{ThemeResource ToggleSwitchTopHeaderMargin}"
                            VerticalAlignment="Top"
                            x:DeferLoadStrategy="Lazy"
                            AutomationProperties.AccessibilityView="Raw"
                            Content="{TemplateBinding Header}"
                            ContentTemplate="{TemplateBinding HeaderTemplate}"
                            Foreground="{ThemeResource ToggleSwitchHeaderForeground}"
                            IsHitTestVisible="False"
                            TextWrapping="Wrap"
                            Visibility="Collapsed" />
                        <Grid
                            Grid.Row="1"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Top">

                            <Grid.RowDefinitions>
                                <RowDefinition Height="4" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="4" />
                            </Grid.RowDefinitions>

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="12" MaxWidth="12" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid
                                x:Name="SwitchAreaGrid"
                                Grid.RowSpan="3"
                                Grid.ColumnSpan="3"
                                Margin="0,5"
                                Background="{ThemeResource ToggleSwitchContainerBackground}"
                                Control.IsTemplateFocusTarget="True"
                                CornerRadius="{TemplateBinding CornerRadius}" />

                            <Rectangle
                                x:Name="OuterBorder"
                                Grid.Row="1"
                                Grid.Column="2"
                                Width="44"
                                Height="28"
                                Fill="{ThemeResource ToggleSwitchFillOff}"
                                RadiusX="14"
                                RadiusY="14"
                                Stroke="{ThemeResource ToggleSwitchStrokeOff}"
                                StrokeThickness="{ThemeResource ToggleSwitchOuterBorderStrokeThickness}" />
                            <Rectangle
                                x:Name="SwitchKnobBounds"
                                Grid.Row="1"
                                Grid.Column="2"
                                Width="44"
                                Height="28"
                                Fill="{ThemeResource ToggleSwitchFillOn}"
                                Opacity="0"
                                RadiusX="14"
                                RadiusY="14"
                                Stroke="{ThemeResource ToggleSwitchStrokeOn}"
                                StrokeThickness="{ThemeResource ToggleSwitchOnStrokeThickness}" />
                            <Grid
                                x:Name="SwitchKnob"
                                Grid.Row="1"
                                Grid.Column="2"
                                Width="24"
                                Height="24"
                                HorizontalAlignment="Left">
                                <Border
                                    x:Name="SwitchKnobOn"
                                    Width="20"
                                    Height="20"
                                    Margin="0,0,3,0"
                                    HorizontalAlignment="Right"
                                    Background="{ThemeResource ToggleSwitchKnobFillOn}"
                                    BackgroundSizing="OuterBorderEdge"
                                    BorderBrush="{ThemeResource ToggleSwitchKnobStrokeOn}"
                                    CornerRadius="10"
                                    Opacity="0"
                                    RenderTransformOrigin="0.5, 0.5"
                                    ToolTipService.ToolTip="{loc:Locale Name=ShowDanmaku}">
                                    <Border.RenderTransform>
                                        <CompositeTransform />
                                    </Border.RenderTransform>
                                    <icons:RegularFluentIcon
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center"
                                        FontSize="12"
                                        Symbol="TextBulletListTree16" />
                                </Border>
                                <Border
                                    x:Name="SwitchKnobOff"
                                    Width="20"
                                    Height="20"
                                    Margin="3,0,0,0"
                                    HorizontalAlignment="Left"
                                    Background="{ThemeResource ToggleSwitchKnobFillOff}"
                                    CornerRadius="10"
                                    RenderTransformOrigin="0.5, 0.5"
                                    ToolTipService.ToolTip="{loc:Locale Name=HideDanmaku}">
                                    <Border.RenderTransform>
                                        <CompositeTransform />
                                    </Border.RenderTransform>
                                    <icons:RegularFluentIcon
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center"
                                        FontSize="12"
                                        Foreground="{ThemeResource ToggleSwitchKnobOffForeground}"
                                        Symbol="TextBulletListTree16" />
                                </Border>
                                <Grid.RenderTransform>
                                    <TranslateTransform x:Name="KnobTranslateTransform" />
                                </Grid.RenderTransform>
                            </Grid>
                            <Thumb
                                x:Name="SwitchThumb"
                                Grid.RowSpan="3"
                                Grid.ColumnSpan="3"
                                AutomationProperties.AccessibilityView="Raw">
                                <Thumb.Template>
                                    <ControlTemplate TargetType="Thumb">
                                        <Rectangle Fill="Transparent" />
                                    </ControlTemplate>
                                </Thumb.Template>
                            </Thumb>

                        </Grid>

                    </Grid>

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

    <Style
        x:Key="TitleBarButtonStyle"
        BasedOn="{StaticResource DefaultButtonStyle}"
        TargetType="Button">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid Padding="{TemplateBinding Padding}" Background="{ThemeResource SystemControlTransparentBrush}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />

                                <VisualState x:Name="PointerOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBackgroundPointerOver}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPointerOver}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPointerOver}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                    <VisualState.Setters>
                                        <Setter Target="ContentPresenter.(muxc:AnimatedIcon.State)" Value="PointerOver" />
                                    </VisualState.Setters>
                                </VisualState>

                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBackgroundPressed}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPressed}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPressed}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                    <VisualState.Setters>
                                        <Setter Target="ContentPresenter.(muxc:AnimatedIcon.State)" Value="Pressed" />
                                    </VisualState.Setters>
                                </VisualState>

                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBackgroundDisabled}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushDisabled}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundDisabled}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                    <VisualState.Setters>
                                        <!-- DisabledVisual Should be handled by the control, not the animated icon. -->
                                        <Setter Target="ContentPresenter.(muxc:AnimatedIcon.State)" Value="Normal" />
                                    </VisualState.Setters>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter
                            x:Name="ContentPresenter"
                            Width="36"
                            Height="32"
                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                            muxc:AnimatedIcon.State="Normal"
                            AutomationProperties.AccessibilityView="Raw"
                            Background="{TemplateBinding Background}"
                            BackgroundSizing="{TemplateBinding BackgroundSizing}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            ContentTransitions="{TemplateBinding ContentTransitions}"
                            CornerRadius="{TemplateBinding CornerRadius}">

                            <ContentPresenter.BackgroundTransition>
                                <BrushTransition Duration="0:0:0.083" />
                            </ContentPresenter.BackgroundTransition>
                        </ContentPresenter>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="NoAnimationExpanderStyle" TargetType="muxc:Expander">
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Background" Value="{ThemeResource ExpanderContentBackground}" />
        <Setter Property="MinWidth" Value="{ThemeResource FlyoutThemeMinWidth}" />
        <Setter Property="MinHeight" Value="{StaticResource ExpanderMinHeight}" />
        <Setter Property="BorderThickness" Value="{ThemeResource ExpanderContentDownBorderThickness}" />
        <Setter Property="BorderBrush" Value="{ThemeResource ExpanderContentBorderBrush}" />
        <Setter Property="Padding" Value="{StaticResource ExpanderContentPadding}" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="muxc:Expander">
                    <Grid MinWidth="{TemplateBinding MinWidth}" MaxWidth="{TemplateBinding MaxWidth}">

                        <Grid.RowDefinitions>
                            <RowDefinition x:Name="Row0" Height="Auto" />
                            <RowDefinition x:Name="Row1" Height="*" />
                        </Grid.RowDefinitions>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="ExpandStates">
                                <VisualState x:Name="ExpandUp">
                                    <VisualState.Setters>
                                        <Setter Target="ExpanderHeader.CornerRadius" Value="{Binding CornerRadius, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BottomCornerRadiusFilterConverter}}" />
                                    </VisualState.Setters>
                                    <VisualState.Storyboard>
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpanderContent" Storyboard.TargetProperty="Visibility">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                            </ObjectAnimationUsingKeyFrames>
                                            <!--<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpanderContent" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)">
                                                <DiscreteDoubleKeyFrame KeyTime="0" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ContentHeight}" />
                                            </DoubleAnimationUsingKeyFrames>-->
                                        </Storyboard>
                                    </VisualState.Storyboard>
                                </VisualState>
                                <VisualState x:Name="CollapseDown">
                                    <VisualState.Storyboard>
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpanderContent" Storyboard.TargetProperty="Visibility">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0.2" Value="Collapsed" />
                                            </ObjectAnimationUsingKeyFrames>
                                            <!--<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpanderContent" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)">
                                                <DiscreteDoubleKeyFrame KeyTime="0" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>-->
                                        </Storyboard>
                                    </VisualState.Storyboard>
                                </VisualState>
                                <VisualState x:Name="ExpandDown">
                                    <VisualState.Setters>
                                        <Setter Target="ExpanderHeader.CornerRadius" Value="{Binding CornerRadius, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TopCornerRadiusFilterConverter}}" />
                                    </VisualState.Setters>
                                    <VisualState.Storyboard>
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpanderContent" Storyboard.TargetProperty="Visibility">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                            </ObjectAnimationUsingKeyFrames>
                                            <!--<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpanderContent" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)">
                                                <DiscreteDoubleKeyFrame KeyTime="0" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.NegativeContentHeight}" />
                                            </DoubleAnimationUsingKeyFrames>-->
                                        </Storyboard>
                                    </VisualState.Storyboard>
                                </VisualState>
                                <VisualState x:Name="CollapseUp">
                                    <VisualState.Storyboard>
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpanderContent" Storyboard.TargetProperty="Visibility">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0.167" Value="Collapsed" />
                                            </ObjectAnimationUsingKeyFrames>
                                            <!--<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpanderContent" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)">
                                                <DiscreteDoubleKeyFrame KeyTime="0" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>-->
                                        </Storyboard>
                                    </VisualState.Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ExpandDirectionStates">
                                <VisualState x:Name="Down" />
                                <VisualState x:Name="Up">
                                    <VisualState.Setters>
                                        <Setter Target="ExpanderHeader.Style" Value="{StaticResource ExpanderHeaderUpStyle}" />
                                        <Setter Target="ExpanderContent.BorderThickness" Value="{StaticResource ExpanderContentUpBorderThickness}" />
                                        <Setter Target="ExpanderContent.CornerRadius" Value="{Binding CornerRadius, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TopCornerRadiusFilterConverter}}" />
                                        <Setter Target="ExpanderHeader.(Grid.Row)" Value="1" />
                                        <Setter Target="ExpanderContentClip.(Grid.Row)" Value="0" />
                                        <Setter Target="Row0.Height" Value="*" />
                                        <Setter Target="Row1.Height" Value="Auto" />
                                    </VisualState.Setters>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ToggleButton
                            x:Name="ExpanderHeader"
                            AutomationProperties.AutomationId="ExpanderToggleButton"
                            Style="{StaticResource ExpanderHeaderDownStyle}"
                            MinHeight="{TemplateBinding MinHeight}"
                            Padding="0"
                            HorizontalAlignment="Stretch"
                            HorizontalContentAlignment="{StaticResource ExpanderHeaderHorizontalContentAlignment}"
                            VerticalContentAlignment="{StaticResource ExpanderHeaderVerticalContentAlignment}"
                            Background="{ThemeResource ExpanderHeaderBackground}"
                            BackgroundSizing="{TemplateBinding BackgroundSizing}"
                            BorderBrush="{ThemeResource ExpanderHeaderBorderBrush}"
                            BorderThickness="{ThemeResource ExpanderHeaderBorderThickness}"
                            Content="{TemplateBinding Header}"
                            ContentTemplate="{TemplateBinding HeaderTemplate}"
                            ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                            CornerRadius="{TemplateBinding CornerRadius}"
                            IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                            IsEnabled="{TemplateBinding IsEnabled}" />
                        <!-- The clip is a composition clip applied in code -->
                        <Border x:Name="ExpanderContentClip" Grid.Row="1">
                            <Border
                                x:Name="ExpanderContent"
                                MinHeight="{TemplateBinding MinHeight}"
                                Padding="{TemplateBinding Padding}"
                                HorizontalAlignment="Stretch"
                                VerticalAlignment="Stretch"
                                Background="{TemplateBinding Background}"
                                BackgroundSizing="{TemplateBinding BackgroundSizing}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{StaticResource ExpanderContentDownBorderThickness}"
                                CornerRadius="{Binding CornerRadius, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BottomCornerRadiusFilterConverter}}"
                                Visibility="Collapsed">
                                <ContentPresenter
                                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                    Content="{TemplateBinding Content}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
                                <Border.RenderTransform>
                                    <CompositeTransform />
                                </Border.RenderTransform>
                            </Border>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
