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

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../Brushes/DefaultColorTheme.xaml"/>
        <ResourceDictionary Source="ButtonFocusVisualStyle.xaml"/>
        <ResourceDictionary Source="../Icons/PlayArrowIconStyle.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="UnfocusedToggleButton" TargetType="{x:Type ToggleButton}">
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="ClickMode" Value="Press"/>
        <Setter Property="Foreground" Value="{StaticResource ButtonNormalForegroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border x:Name="Border" 
                            BorderThickness="0" 
                            CornerRadius="0"
                            Background="Transparent"
                            Opacity="1.0">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="50"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" x:Name="selectionIndicator"
                                       Style="{StaticResource PlayArrowIcon}"
                                       Visibility="Visible" 
                                       HorizontalAlignment="Center"
                                       VerticalAlignment="Center"
                                       Foreground="{StaticResource ButtonKeyboardFocusForegroundBrush}"/>
                            <TextBlock Grid.Column="1" 
                                       Text="{Binding DisplayName}"
                                       VerticalAlignment="Center"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="FocusedTogglebutton" TargetType="{x:Type ToggleButton}">
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="ClickMode" Value="Press"/>
        <Setter Property="Foreground" Value="{StaticResource ButtonKeyboardFocusForegroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border x:Name="Border" 
                            BorderThickness="0" 
                            CornerRadius="0"
                            Background="{StaticResource ButtonKeyboardFocusBackgroundBrush}"
                            Opacity="1.0">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="50"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" x:Name="selectionIndicator"
                                       Style="{StaticResource PlayArrowIcon}"
                                       Visibility="Visible" 
                                       HorizontalAlignment="Center"
                                       VerticalAlignment="Center"/>
                            <TextBlock Grid.Column="1" 
                                       Text="{Binding DisplayName}"
                                       VerticalAlignment="Center"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type ComboBoxItem}" x:Key="ComboBoxItemStyle">
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Foreground" Value="{StaticResource ButtonNormalBackgroundBrush}"></Setter>
        <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                    <Border Name="Border" Background="{TemplateBinding Background}">
                        <ContentPresenter Margin="10,5,0,5"></ContentPresenter>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsKeyboardFocused" Value="True">
                            <Setter TargetName="Border" Property="Background">
                                <Setter.Value>
                                    <SolidColorBrush Color="{StaticResource ButtonKeyboardFocusForegroundColor}" />
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Foreground">
                                <Setter.Value>
                                    <SolidColorBrush Color="{StaticResource ButtonKeyboardFocusBackgroundColor}" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ComboBoxRenumber" TargetType="ComboBox">
        <Setter Property="FontFamily" Value="Arial"/>
        <Setter Property="FontSize" Value="16"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="Height" Value="30"/>
        <Setter Property="Foreground" Value="{StaticResource ButtonNormalBackgroundBrush}"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />
        <Setter Property="ItemContainerStyle" Value="{StaticResource ComboBoxItemStyle}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBox">
                    <Grid Name="ComboBoxGrid">
                        <ToggleButton Name="ToggleButton"
                                      Style="{StaticResource UnfocusedToggleButton}"
                                      IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}">
                        </ToggleButton>
                        <ContentControl Name="ContentSite"
                                        IsHitTestVisible="False"
                                        Content="{TemplateBinding SelectionBoxItem}"
                                        ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                        ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                        Margin="65,3,23,3"
                                        VerticalAlignment="Center"
                                        HorizontalAlignment="Center"
                                        Focusable="False"/>
                        <Popup Name="Popup"
                               Placement="Bottom"
                               IsOpen="{TemplateBinding IsDropDownOpen}"
                               AllowsTransparency="True"
                               Focusable="False"
                               PopupAnimation="Fade">
                            <Grid Name="DropDown"                                  
                                  Width="{TemplateBinding ActualWidth}"
                                  MaxHeight="{TemplateBinding MaxDropDownHeight}">
                                <Border x:Name="DropDownBorder"
                                        Background="{StaticResource ButtonNormalForegroundBrush}"
                                        BorderThickness="3"
                                        BorderBrush="{StaticResource ButtonNormalBorderBrush}"
                                        CornerRadius="0"
                                        Margin="0"/>
                                <ScrollViewer SnapsToDevicePixels="True">
                                    <ItemsPresenter Width="{TemplateBinding ActualWidth}" Margin="6"></ItemsPresenter>
                                </ScrollViewer>
                            </Grid>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="FocusManager.FocusedElement" Value="{Binding RelativeSource={RelativeSource Self}}" />
                            <Setter Property="Style" TargetName="ToggleButton" Value="{StaticResource FocusedTogglebutton}"></Setter>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="True">
                            <Setter Property="Style" TargetName="ToggleButton" Value="{StaticResource FocusedTogglebutton}"></Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
                    
