<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Controls="clr-namespace:MahApps.Metro.Controls">

    <!--  obsolete  -->
    <ControlTemplate x:Key="SplitButtonHorizontal" TargetType="{x:Type Controls:DropDownButton}">
        <Border x:Name="PART_Border"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Button x:Name="PART_Button"
                    Background="{TemplateBinding Background}"
                    Command="{TemplateBinding Command}"
                    CommandParameter="{TemplateBinding CommandParameter}"
                    CommandTarget="{TemplateBinding CommandTarget}"
                    Foreground="{TemplateBinding Foreground}"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                    Style="{TemplateBinding ButtonStyle}">
                <StackPanel HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            Orientation="Horizontal">
                    <ContentPresenter Content="{TemplateBinding Icon}" RecognizesAccessKey="True" />
                    <ContentControl x:Name="PART_ButtonContent"
                                    MinWidth="20"
                                    Margin="3"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    Content="{Binding Content, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                    ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
                    <Rectangle x:Name="PART_Rectangle"
                               Width="10"
                               Height="6"
                               Margin="0 0 3 0"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               Fill="{TemplateBinding ArrowBrush}">
                        <Rectangle.OpacityMask>
                            <VisualBrush Stretch="Fill">
                                <VisualBrush.Visual>
                                    <Canvas Width="18"
                                            Height="18"
                                            Clip="F1 M 0,0L 48,0L 48,48L 0,48L 0,0"
                                            UseLayoutRounding="False">
                                        <Path Canvas.Left="14.9063"
                                              Canvas.Top="15.75"
                                              Width="18"
                                              Height="16"
                                              Data="F1 M 23.9063,25L 25.9063,23L 32.9063,15.75L 32.9063,22.25L 23.9062,31.75L 14.9063,22.25L 14.9063,15.75L 21.9063,23L 23.9063,25 Z "
                                              Fill="{DynamicResource BlackColorBrush}"
                                              Stretch="Fill" />
                                    </Canvas>
                                </VisualBrush.Visual>
                            </VisualBrush>
                        </Rectangle.OpacityMask>
                    </Rectangle>
                </StackPanel>
                <Button.ContextMenu>
                    <ContextMenu x:Name="PART_Menu"
                                 MinWidth="{TemplateBinding ActualWidth}"
                                 DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
                                 IsOpen="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                 ItemContainerStyle="{TemplateBinding ItemContainerStyle}"
                                 ItemContainerStyleSelector="{TemplateBinding ItemContainerStyleSelector}"
                                 ItemStringFormat="{TemplateBinding ItemStringFormat}"
                                 ItemTemplate="{TemplateBinding ItemTemplate}"
                                 ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                 ItemsSource="{TemplateBinding ItemsSource}"
                                 Placement="Bottom"
                                 StaysOpen="False"
                                 UseLayoutRounding="False" />
                </Button.ContextMenu>
            </Button>
        </Border>
    </ControlTemplate>

    <!--  obsolete  -->
    <ControlTemplate x:Key="SplitButtonVertical" TargetType="{x:Type Controls:DropDownButton}">
        <Border x:Name="PART_Border"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Button x:Name="PART_Button"
                    Width="{TemplateBinding Width}"
                    Background="{TemplateBinding Background}"
                    Command="{TemplateBinding Command}"
                    CommandParameter="{TemplateBinding CommandParameter}"
                    CommandTarget="{TemplateBinding CommandTarget}"
                    Foreground="{TemplateBinding Foreground}"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                    Style="{TemplateBinding ButtonStyle}">
                <StackPanel HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            Orientation="Vertical">
                    <ContentPresenter Content="{TemplateBinding Icon}" RecognizesAccessKey="True" />
                    <ContentControl x:Name="PART_ButtonContent"
                                    MinHeight="20"
                                    Margin="3"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="Stretch"
                                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                    Content="{Binding Content, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                    ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
                    <Rectangle x:Name="PART_Rectangle"
                               Width="10"
                               Height="6"
                               Margin="0 0 0 3"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               Fill="{TemplateBinding ArrowBrush}">
                        <Rectangle.OpacityMask>
                            <VisualBrush Stretch="Fill">
                                <VisualBrush.Visual>
                                    <Canvas Width="18"
                                            Height="18"
                                            Clip="F1 M 0,0L 48,0L 48,48L 0,48L 0,0"
                                            UseLayoutRounding="False">
                                        <Path Canvas.Left="14.9063"
                                              Canvas.Top="15.75"
                                              Width="18"
                                              Height="16"
                                              Data="F1 M 23.9063,25L 25.9063,23L 32.9063,15.75L 32.9063,22.25L 23.9062,31.75L 14.9063,22.25L 14.9063,15.75L 21.9063,23L 23.9063,25 Z "
                                              Fill="{DynamicResource BlackColorBrush}"
                                              Stretch="Fill" />
                                    </Canvas>
                                </VisualBrush.Visual>
                            </VisualBrush>
                        </Rectangle.OpacityMask>
                    </Rectangle>
                </StackPanel>
                <Button.ContextMenu>
                    <ContextMenu x:Name="PART_Menu"
                                 MinWidth="{TemplateBinding ActualWidth}"
                                 DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
                                 IsOpen="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                 ItemContainerStyle="{TemplateBinding ItemContainerStyle}"
                                 ItemContainerStyleSelector="{TemplateBinding ItemContainerStyleSelector}"
                                 ItemStringFormat="{TemplateBinding ItemStringFormat}"
                                 ItemTemplate="{TemplateBinding ItemTemplate}"
                                 ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                 ItemsSource="{TemplateBinding ItemsSource}"
                                 Placement="Bottom"
                                 StaysOpen="False"
                                 UseLayoutRounding="False" />
                </Button.ContextMenu>
            </Button>
        </Border>
    </ControlTemplate>

    <Style x:Key="ButtonDropDownFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Margin="1"
                               SnapsToDevicePixels="true"
                               Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
                               StrokeDashArray="1 2"
                               StrokeThickness="1" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Controls:DropDownButton}">
        <Setter Property="ArrowBrush" Value="{DynamicResource BlackColorBrush}" />
        <Setter Property="ArrowMouseOverBrush" Value="{DynamicResource AccentColorBrush}" />
        <Setter Property="ArrowPressedBrush" Value="{DynamicResource BlackColorBrush}" />
        <Setter Property="Background" Value="{DynamicResource WhiteColorBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource BlackColorBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="ButtonStyle" Value="{DynamicResource ButtonDropDownStyle}" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonDropDownFocusVisual}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="FontFamily" Value="{DynamicResource ContentFontFamily}" />
        <Setter Property="FontSize" Value="{DynamicResource ContentFontSize}" />
        <Setter Property="Foreground" Value="{DynamicResource BlackColorBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="MenuStyle" Value="{DynamicResource MetroContextMenu}" />
        <Setter Property="MinHeight" Value="26" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:DropDownButton}">
                    <Border x:Name="PART_Border"
                            Background="Transparent"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="{TemplateBinding Controls:ControlsHelper.CornerRadius}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            UseLayoutRounding="True">
                        <Controls:ClipBorder x:Name="PART_ClipBorder"
                                             CornerRadius="{TemplateBinding Controls:ControlsHelper.CornerRadius}"
                                             SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                            <Button x:Name="PART_Button"
                                    HorizontalAlignment="Stretch"
                                    VerticalAlignment="Stretch"
                                    HorizontalContentAlignment="Stretch"
                                    VerticalContentAlignment="Stretch"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    Command="{TemplateBinding Command}"
                                    CommandParameter="{TemplateBinding CommandParameter}"
                                    CommandTarget="{TemplateBinding CommandTarget}"
                                    FocusVisualStyle="{TemplateBinding FocusVisualStyle}"
                                    Foreground="{TemplateBinding Foreground}"
                                    RenderOptions.ClearTypeHint="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(RenderOptions.ClearTypeHint), Mode=OneWay}"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                    Style="{TemplateBinding ButtonStyle}">
                                <DockPanel x:Name="PART_Content"
                                           Focusable="False"
                                           LastChildFill="True">
                                    <!--  Material - ChevronDown  -->
                                    <ContentControl x:Name="PART_Arrow"
                                                    Width="9"
                                                    Height="9"
                                                    Margin="0 0 3 0"
                                                    HorizontalAlignment="Center"
                                                    VerticalAlignment="Center"
                                                    Content="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"
                                                    DockPanel.Dock="Right"
                                                    Foreground="{TemplateBinding ArrowBrush}"
                                                    Style="{DynamicResource PathIconContentControlStyle}"
                                                    Visibility="{TemplateBinding ArrowVisibility}" />
                                    <StackPanel x:Name="PART_ContentOrientation"
                                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                Focusable="False"
                                                Orientation="Horizontal">
                                        <ContentPresenter HorizontalAlignment="Center"
                                                          VerticalAlignment="Center"
                                                          Content="{TemplateBinding Icon}"
                                                          ContentTemplate="{TemplateBinding IconTemplate}"
                                                          Focusable="False"
                                                          RecognizesAccessKey="True"
                                                          UseLayoutRounding="False" />
                                        <Controls:ContentControlEx x:Name="PART_ButtonContent"
                                                                   Margin="3"
                                                                   Padding="{TemplateBinding Padding}"
                                                                   HorizontalAlignment="Center"
                                                                   VerticalAlignment="Center"
                                                                   HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                                   VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                                                   Content="{Binding Content, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                                                   ContentCharacterCasing="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.ContentCharacterCasing)}"
                                                                   ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                                                   ContentTemplate="{TemplateBinding ContentTemplate}"
                                                                   ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                                                   RecognizesAccessKey="True"
                                                                   SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                                                   UseLayoutRounding="False" />
                                    </StackPanel>
                                </DockPanel>
                                <Button.ContextMenu>
                                    <ContextMenu x:Name="PART_Menu"
                                                 MinWidth="{TemplateBinding ActualWidth}"
                                                 DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
                                                 IsOpen="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                                 ItemContainerStyle="{TemplateBinding ItemContainerStyle}"
                                                 ItemContainerStyleSelector="{TemplateBinding ItemContainerStyleSelector}"
                                                 ItemStringFormat="{TemplateBinding ItemStringFormat}"
                                                 ItemTemplate="{TemplateBinding ItemTemplate}"
                                                 ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                                 ItemsPanel="{TemplateBinding ItemsPanel}"
                                                 ItemsSource="{TemplateBinding ItemsSource}"
                                                 Placement="Bottom"
                                                 StaysOpen="False"
                                                 Style="{TemplateBinding MenuStyle}"
                                                 UseLayoutRounding="False" />
                                </Button.ContextMenu>
                            </Button>
                        </Controls:ClipBorder>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Content" Value="{x:Null}">
                            <Setter TargetName="PART_ButtonContent" Property="Margin" Value="0" />
                        </Trigger>
                        <Trigger Property="Orientation" Value="Vertical">
                            <Setter TargetName="PART_Arrow" Property="DockPanel.Dock" Value="Bottom" />
                            <Setter TargetName="PART_Arrow" Property="Margin" Value="0 0 0 3" />
                            <Setter TargetName="PART_ContentOrientation" Property="Orientation" Value="Vertical" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="PART_Arrow" Property="Foreground" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ArrowMouseOverBrush, Mode=OneWay}" />
                        </Trigger>
                        <Trigger SourceName="PART_Button" Property="IsPressed" Value="True">
                            <Setter TargetName="PART_Arrow" Property="Foreground" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ArrowPressedBrush, Mode=OneWay}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Style.Triggers>
            <Trigger Property="IsFocused" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource AccentColorBrush}" />
            </Trigger>
            <Trigger Property="IsKeyboardFocusWithin" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource AccentColorBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value=".55" />
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>