<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ghfvs="https://github.com/github/VisualStudio"
                    xmlns:ui="clr-namespace:GitHub.UI">

    <Style TargetType="{x:Type ui:GitHubTabControl}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="AlternationCount" Value="1000" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ui:GitHubTabControl}">
                    <Grid KeyboardNavigation.TabNavigation="Local">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="55" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource GHBoxDividerBrush}">
                            <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <TabPanel
                                    x:Name="HeaderPanel"
                                    Grid.Row="0"
                                    Width="Auto"
                                    HorizontalAlignment="Center"
                                    Panel.ZIndex="1"
                                    IsItemsHost="True"
                                    KeyboardNavigation.TabIndex="1"
                                    Background="Transparent" />

                                <Rectangle
                                    x:Name="TabHighlight"
                                    Visibility="Collapsed"
                                    Grid.Row="1"
                                    Fill="#4183C4"
                                    Margin="0"
                                    Height="2"
                                    Width="{Binding Path=SelectedTabContentWidth, RelativeSource={RelativeSource Self}}"
                                    HorizontalAlignment="Left">
                                    <Rectangle.RenderTransform>
                                        <TranslateTransform x:Name="TabHighlightTransform" X="0" Y="0" />
                                    </Rectangle.RenderTransform>
                                </Rectangle>
                            </Grid>
                        </Border>
                        <ContentPresenter
                            Grid.Row="1"
                            KeyboardNavigation.TabNavigation="Local"
                            KeyboardNavigation.DirectionalNavigation="Contained"
                            KeyboardNavigation.TabIndex="2"
                            x:Name="PART_SelectedContentHost"
                            Margin="0"
                            ContentSource="SelectedContent" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="TabItem">
        <Setter Property="FocusVisualStyle" Value="{StaticResource NoMarginFocusVisual}" />
        <Setter Property="Width" Value="Auto" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TabItem">
                    <Grid Margin="12,2">
                        
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        
                        <TextBlock
                            x:Name="ContentSite"
                            FontWeight="SemiBold"
                            FontSize="14"
                            VerticalAlignment="Center"
                            HorizontalAlignment="Center"
                            Foreground="{StaticResource GHBlueLinkButtonTextBrush}"
                            Text="{TemplateBinding Header}" />

                        <Rectangle
                            x:Name="TabHighlight"
                            Grid.Row="1"
                            Fill="{StaticResource GHBlueLinkButtonTextBrush}"
                            Margin="0"
                            Height="2"
                            Visibility="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type TabItem}}, Converter={ghfvs:BooleanToVisibilityConverter}}" />

                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="ContentSite" Property="Foreground" Value="{StaticResource GHBlueLinkButtonHoverBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>