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

    <ResourceDictionary.MergedDictionaries>
    </ResourceDictionary.MergedDictionaries>
    <ControlTemplate x:Key="GraphTab" TargetType="{x:Type TabControl}">
        <ControlTemplate.Resources>
            <Style TargetType="{x:Type TabItem}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TabItem}">
                            <Grid SnapsToDevicePixels="True" >
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup Name="CommonStates">
                                        <VisualState Name="MouseOver">
                                            <Storyboard>
                                                <ThicknessAnimation Storyboard.TargetName="grid_background" 
                                                                 Storyboard.TargetProperty="Margin" To="0" Duration="0:0:.1"/>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState Name="Normal">
                                            <Storyboard>
                                                <ThicknessAnimation Storyboard.TargetName="grid_background" 
                                                                 Storyboard.TargetProperty="Margin" To="5" Duration="0:0:.1"/>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                    <VisualStateGroup Name="SelectionStates">
                                        <VisualState Name="Selected">
                                            <Storyboard>
                                                <DoubleAnimation Storyboard.TargetName="grid_selected" Storyboard.TargetProperty="Opacity" 
                                                                 To="1" Duration="0:0:.3"/>

                                                <DoubleAnimation Storyboard.TargetName="grid_unselected" Storyboard.TargetProperty="Opacity" 
                                                                 To="0" Duration="0"/>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState Name="Unselected">
                                            <Storyboard>
                                                <DoubleAnimation Storyboard.TargetName="grid_selected" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:.1"/>
                                                <DoubleAnimation Storyboard.TargetName="grid_unselected" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:.1"/>
                                            </Storyboard>
                                            
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <Grid Name="grid_background" Margin="{StaticResource ControlMargin}" >
                                    <Grid Name="grid_unselected" Opacity="0" >
                                        <Border Background="{StaticResource  Brushes.NoAct}" 
                                                CornerRadius="3" />
                                    </Grid>
                                    <Grid Name="grid_selected" Opacity="0" >
                                        <Border Background="{StaticResource Brushes.Activity}" 
                                                CornerRadius="3" />
                                        <Rectangle VerticalAlignment="Bottom" Margin="10,0" Height="4" Fill="{StaticResource Brushes.Gray}"/>
                                    </Grid>
                                    <!--<Grid.Style>
                                        <Style TargetType="Grid">
                                            <Setter Property="Effect">
                                                <Setter.Value>
                                                    <DropShadowEffect Color="Black" Direction="270" ShadowDepth="1" Opacity="0.23" />
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </Grid.Style>-->
                                </Grid>

                                
                                <TextBlock Name="buttonText" 
                                                  TextBlock.FontFamily="Calibri"
                                                  TextBlock.FontSize="12pt"
                                                  TextBlock.Foreground="{StaticResource Brushes.Text.White}"
                                                  Margin="20"
                                                  Text="{TemplateBinding Header}"
                                                  VerticalAlignment="Center"/>
                            </Grid>

                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ControlTemplate.Resources>
        <Grid SnapsToDevicePixels="True" >
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition/>
            </Grid.RowDefinitions>
            <StackPanel IsItemsHost="True" 
                        Orientation="Horizontal"
                        Margin="0,0,-1,0" />
            <ContentPresenter 
                Content="{TemplateBinding SelectedContent}" 
                Grid.Row="1" />
        </Grid>
    </ControlTemplate>
    <Style TargetType="TabControl"  x:Key="GraphTabStyle">
        <Setter Property="Template" Value="{StaticResource GraphTab}"/>
    </Style>

</ResourceDictionary>