<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <SolidColorBrush x:Key="Tab_Header_BG" Color="#FF23416F" />
    <SolidColorBrush x:Key="Tab_BD" Color="Black" />
    <SolidColorBrush x:Key="Tab_Header_BG_MouseOver" Color="#FF58AAE2" />
    <SolidColorBrush x:Key="Tab_BG" Color="#FFEEEEEE" />
    <SolidColorBrush x:Key="Tab_BD_Unable" Color="Gray" />
    <LinearGradientBrush x:Key="Tab_Header_BG_Unable" StartPoint="0.5,0" EndPoint="0.5,1">
        <GradientStop Offset="0" Color="#FFB1B1B1" />
        <GradientStop Offset="1" Color="#FFDADADA" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="Tab_BG_Unable" Color="LightGray" />

    <Style x:Key="TabItemFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle
                        Margin="3,3,3,1"
                        SnapsToDevicePixels="true"
                        Stroke="#7FFFFFFF"
                        StrokeDashArray="1 2"
                        StrokeThickness="1" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type TabControl}">
        <Setter Property="Padding" Value="5" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="BorderBrush" Value="{DynamicResource Tab_BD}" />
        <Setter Property="Background" Value="{DynamicResource Tab_BG}" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid>
                        <Grid
                            ClipToBounds="true"
                            KeyboardNavigation.TabNavigation="Local"
                            SnapsToDevicePixels="true">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition x:Name="ColumnDefinition0" />
                                <ColumnDefinition x:Name="ColumnDefinition1" Width="0" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition x:Name="RowDefinition0" Height="Auto" />
                                <RowDefinition x:Name="RowDefinition1" Height="*" />
                            </Grid.RowDefinitions>
                            <TabPanel
                                x:Name="HeaderPanel"
                                Grid.Row="0"
                                Grid.Column="0"
                                Panel.ZIndex="1"
                                IsItemsHost="true"
                                KeyboardNavigation.TabIndex="1" />
                            <Border
                                x:Name="ContentPanel"
                                Grid.Row="1"
                                Grid.Column="0"
                                Padding="{TemplateBinding Padding}"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                KeyboardNavigation.DirectionalNavigation="Contained"
                                KeyboardNavigation.TabIndex="2"
                                KeyboardNavigation.TabNavigation="Local">
                                <ContentPresenter
                                    x:Name="PART_SelectedContentHost"
                                    ContentSource="SelectedContent"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </Border>
                        </Grid>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TabStripPlacement" Value="Bottom">
                            <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="1" />
                            <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
                            <Setter TargetName="RowDefinition1" Property="Height" Value="Auto" />
                            <Setter TargetName="HeaderPanel" Property="Margin" Value="2,0,2,2" />
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Left">
                            <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="HeaderPanel" Property="Grid.Column" Value="0" />
                            <Setter TargetName="ContentPanel" Property="Grid.Column" Value="1" />
                            <Setter TargetName="ColumnDefinition0" Property="Width" Value="Auto" />
                            <Setter TargetName="ColumnDefinition1" Property="Width" Value="*" />
                            <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
                            <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
                            <Setter TargetName="HeaderPanel" Property="Margin" Value="2,2,0,2" />
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Right">
                            <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="HeaderPanel" Property="Grid.Column" Value="1" />
                            <Setter TargetName="ContentPanel" Property="Grid.Column" Value="0" />
                            <Setter TargetName="ColumnDefinition0" Property="Width" Value="*" />
                            <Setter TargetName="ColumnDefinition1" Property="Width" Value="Auto" />
                            <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
                            <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
                            <Setter TargetName="HeaderPanel" Property="Margin" Value="0,2,2,2" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="ContentPanel" Property="BorderBrush" Value="{DynamicResource Tab_BD_Unable}" />
                            <Setter TargetName="ContentPanel" Property="Background" Value="{DynamicResource Tab_BG_Unable}" />
                            <Setter Property="Foreground" Value="#FF9A9A9A" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type TabItem}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource TabItemFocusVisual}" />
        <Setter Property="Foreground" Value="{DynamicResource SubMenu_FG}" />
        <Setter Property="BorderBrush" Value="{DynamicResource SubMenu_BD_Highlight}" />
        <Setter Property="Background" Value="{DynamicResource Tab_Header_BG}" />
        <Setter Property="FontFamily" Value="Arial" />
        <Setter Property="FontSize" Value="12" />
        <Setter Property="MinWidth" Value="80" />
        <Setter Property="MinHeight" Value="24" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Border
                        x:Name="BG"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="2,2,0,0"
                        CornerRadius="5,5,0,0"
                        Cursor="Hand"
                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Border
                            x:Name="InnerBD"
                            BorderBrush="{DynamicResource SubMenu_BD_Shadow}"
                            BorderThickness="0,0,2,0"
                            CornerRadius="4,4,0,0">
                            <ContentPresenter
                                x:Name="Content"
                                Margin="10,3,10,1"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                ContentSource="Header"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger SourceName="BG" Property="IsMouseOver" Value="true">
                            <Setter TargetName="BG" Property="Background" Value="{DynamicResource Tab_Header_BG_MouseOver}" />
                            <Setter Property="Foreground" Value="{DynamicResource SubMenu_FG_Select}" />
                        </Trigger>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter TargetName="BG" Property="Background" Value="{DynamicResource Tab_Header_BG_MouseOver}" />
                            <Setter TargetName="BG" Property="BorderBrush" Value="{DynamicResource SubMenu_BD_Highlight}" />
                            <Setter TargetName="InnerBD" Property="BorderBrush" Value="{DynamicResource SubMenu_BD_Shadow_Select}" />
                            <Setter Property="Foreground" Value="{DynamicResource FG_Black}" />
                            <Setter Property="FontSize" Value="14" />
                            <Setter TargetName="Content" Property="Effect">
                                <Setter.Value>
                                    <DropShadowEffect
                                        BlurRadius="5"
                                        ShadowDepth="0"
                                        Color="White" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Bottom">
                            <Setter TargetName="BG" Property="BorderThickness" Value="1,0,1,1" />
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Left">
                            <Setter TargetName="BG" Property="BorderThickness" Value="1,1,0,1" />
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Right">
                            <Setter TargetName="BG" Property="BorderThickness" Value="0,1,1,1" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="true" />
                                <Condition Property="TabStripPlacement" Value="Top" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Content" Property="Margin" Value="10,3,10,1" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="true" />
                                <Condition Property="TabStripPlacement" Value="Bottom" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Content" Property="Margin" Value="5,1,5,0" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="true" />
                                <Condition Property="TabStripPlacement" Value="Left" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Content" Property="Margin" Value="5,0,6,0" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="true" />
                                <Condition Property="TabStripPlacement" Value="Right" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Content" Property="Margin" Value="6,0,5,0" />
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="BorderBrush" Value="{DynamicResource Tab_BD_Unable}" />
                            <Setter TargetName="BG" Property="Background" Value="{DynamicResource Tab_Header_BG_Unable}" />
                            <Setter Property="Foreground" Value="#FF9A9A9A" />
                            <Setter TargetName="Content" Property="Effect">
                                <Setter.Value>
                                    <DropShadowEffect
                                        BlurRadius="0"
                                        Opacity="0"
                                        ShadowDepth="1" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>