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

    <Style x:Key="FilterPanelNagivationButton" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Padding" Value="6,5,6,5" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="BorderBrush" Value="{x:Null}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Margin" Value="15,5,15,5" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid Background="{TemplateBinding Background}">
                        <DockPanel Margin="{TemplateBinding Padding}">
                            <TextBlock Text="&#xeab8;" FontFamily="{StaticResource FontIcoFont}"
                                       DockPanel.Dock="Right"
                                       Foreground="{TemplateBinding Foreground}"
                                       FontSize="20"
                                       VerticalAlignment="Center"/>
                            <TextBlock Style="{DynamicResource TextBlockBaseStyle}"
                                       DockPanel.Dock="Left"
                                       Foreground="{TemplateBinding Foreground}"
                                       HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                       VerticalAlignment="{TemplateBinding VerticalContentAlignment}">                            
                                <ContentPresenter />
                            </TextBlock>
                        </DockPanel>

                        <Border BorderThickness="{TemplateBinding BorderThickness}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                x:Name="BorderStandard" />

                        <Border x:Name="BorderFocus" Margin="-3"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                BorderBrush="{DynamicResource SelectionBrush}"
                                BorderThickness="3" Visibility="Hidden" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter Property="Background" Value="{DynamicResource ControlBackgroundDarkBrush}" />
                            <Setter Property="Visibility" Value="Visible" TargetName="BorderFocus" />
                            <Setter Property="Visibility" Value="Hidden" TargetName="BorderStandard" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="{DynamicResource ControlBackgroundDarkBrush}" />
                            <Setter Property="Visibility" Value="Visible" TargetName="BorderFocus" />
                            <Setter Property="Visibility" Value="Hidden" TargetName="BorderStandard" />
                        </Trigger>
                        <Trigger Property="Tag" Value="{StaticResource True}">
                            <Setter Property="Foreground" Value="{DynamicResource GlyphLightBrush}" />
                            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="FilterItemtSelectionStyle" TargetType="CheckBoxEx" BasedOn="{StaticResource {x:Type CheckBoxEx}}">
        <Setter Property="Margin" Value="15,5,15,5" />
    </Style>

    <Style x:Key="FilterPanelCheckBoxEx" TargetType="CheckBoxEx" BasedOn="{StaticResource {x:Type CheckBoxEx}}">
        <Setter Property="Margin" Value="15,5,15,5" />
    </Style>

    <Style x:Key="FilterPanelButtonEx" TargetType="ButtonEx" BasedOn="{StaticResource {x:Type ButtonEx}}">
        <Setter Property="Margin" Value="15,5,15,5" />
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
        <Style.Triggers>
            <Trigger Property="Tag" Value="{StaticResource True}">
                <Setter Property="Foreground" Value="{DynamicResource GlyphLightBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="FilterPanelComboBoxEx" TargetType="ComboBoxEx" BasedOn="{StaticResource {x:Type ComboBoxEx}}">
        <Setter Property="Margin" Value="15,5,15,5" />
    </Style>

    <Style x:Key="FilterPanelText" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
        <Setter Property="Margin" Value="15,20,15,5" />
    </Style>

    <Style x:Key="FilterPanelFilterPresetActionButton" TargetType="ButtonEx" BasedOn="{StaticResource {x:Type ButtonEx}}">
        <Setter Property="Margin" Value="15,5,15,5" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
    </Style>

    <DataTemplate x:Key="FilterPanelAddPresetTemplate">
        <TextBlock Text="&#xee00;" TextAlignment="Center"
                   FontFamily="{DynamicResource FontIcoFont}"
                   FontSize="20" Foreground="{DynamicResource TextBrush}"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="FilterPanelRenamePresetTemplate">
        <TextBlock Text="&#xec55;" TextAlignment="Center"
                   FontFamily="{DynamicResource FontIcoFont}"
                   FontSize="20" Foreground="{DynamicResource TextBrush}"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="FilterPanelRemovePresetTemplate">
        <TextBlock Text="&#xec53;" TextAlignment="Center"
                   FontFamily="{DynamicResource FontIcoFont}"
                   FontSize="20" Foreground="{DynamicResource TextBrush}"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <Style TargetType="{x:Type Filters}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Filters}">
                    <Border Background="{DynamicResource OverlayMenuBackgroundBrush}"
                            MinWidth="{DynamicResource FilterPanelWidth}">
                        <ItemsControlEx x:Name="PART_ItemsHost" Focusable="False"
                                        KeyboardNavigation.DirectionalNavigation="Once">
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel />
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                            <ItemsControl.Template>
                                <ControlTemplate>
                                    <ScrollViewer Focusable="False"
                                                  HorizontalScrollBarVisibility="Disabled"
                                                  VerticalScrollBarVisibility="Auto"
                                                  CanContentScroll="True">
                                        <ItemsPresenter />
                                    </ScrollViewer>
                                </ControlTemplate>
                            </ItemsControl.Template>
                        </ItemsControlEx>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>