<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:MaxLauncher;assembly=MaxLauncher">

    <!-- *********************************************************************************** -->
    <!-- TabButtonStyle -->
    <Style TargetType="{x:Type local:TabButton}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="BorderThickness" Value="{DynamicResource TabButton.Border.Thickness}"/>
        <Setter Property="Margin" Value="{DynamicResource TabButton.Margin}" />
        <Setter Property="BorderBrush" Value="{DynamicResource TabButton.BorderBrush}"/>
        <Setter Property="Background" Value="{DynamicResource TabButton.Background}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:MButton}">
                    <Border x:Name="BD"
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Margin="{TemplateBinding Margin}"
                            Background="{TemplateBinding Background}"
                            SnapsToDevicePixels="True"
                            CornerRadius="{DynamicResource TabButton.CornerRadius}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Image Grid.Row="0" 
                                   Source="{TemplateBinding Image}" 
                                   Stretch="Uniform"
                                   Margin="5">
                            </Image>
                            <TextBlock x:Name="ButtonText" Grid.Row="1" 
                                       Text="{TemplateBinding Text}" 
                                       TextWrapping="Wrap" 
                                       TextAlignment="Center" 
                                       TextTrimming="CharacterEllipsis"
                                       Foreground="{DynamicResource TabButton.Text.Foreground}"
                                       FontSize="{DynamicResource TabButton.Text.FontSize}"
                                       FontFamily="{DynamicResource TabButton.Text.FontFamily}"
									                     ToolTip="{TemplateBinding Text}"
                                       Margin="5,0,5,5">
                            </TextBlock>
                            <TextBlock x:Name="KeyText" Text="{TemplateBinding Key}"
                                   HorizontalAlignment="Left" 
                                   Margin="3,2,0,0" 
                                   Foreground="{DynamicResource TabButton.Key.Foreground}" 
                                   FontSize="{DynamicResource TabButton.Key.FontSize}"
                                   FontFamily="{DynamicResource TabButton.Key.FontFamily}"
                                   Padding="0" >
                            </TextBlock>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" TargetName="BD" Value="{DynamicResource TabButton.MouseOver.Background}" />
                            <Setter Property="Foreground" TargetName="KeyText" Value="{DynamicResource TabButton.MouseOver.Foreground}" />
                            <Setter Property="Foreground" TargetName="ButtonText" Value="{DynamicResource TabButton.MouseOver.Foreground}" />
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter Property="BorderBrush" Value="{DynamicResource TabButton.Focused.BorderBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
