<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib"
                    mc:Ignorable="d">

    <DataTemplate x:Key="TopPanelGeneralViewSettingsTemplate">
        <TextBlock Text="&#xefe2;" FontFamily="{DynamicResource FontIcoFont}" FontSize="18"                   
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelFilterPresetsSelectionTemplate">
        <TextBlock Text="&#xeec0;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelGroupSettingsTemplate">
        <TextBlock Text="&#xee03;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelSortSettingsTemplate">
        <TextBlock Text="&#xefee;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelSwitchDetailsViewTemplate">
        <TextBlock Text="&#xE145;" FontFamily="Segoe UI Symbol" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelSwitchGridViewTemplate">
        <TextBlock Text="&#xE138;" FontFamily="Segoe UI Symbol" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelSwitchListViewTemplate">
        <TextBlock Text="&#xE14C;" FontFamily="Segoe UI Symbol" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>
    
    <DataTemplate x:Key="TopPanelUpdateButtonTemplate">
        <TextBlock Foreground="{DynamicResource WarningBrush}"
                   VerticalAlignment="Center" HorizontalAlignment="Center"
                   Text="&#xef08;" FontSize="24" FontFamily="{DynamicResource FontIcoFont}"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelExplorerSwitchTemplate">
        <TextBlock Text="&#xeeed;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelSelectRandomGameButtonTemplate">
        <TextBlock Text="&#xef03;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelViewSelectRandomGameButtonTemplate">
        <TextBlock Text="&#xefcf;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>
    
    <DataTemplate x:Key="TopPanelSearchButtonTemplate">
        <TextBlock Text="&#xed12;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <Style x:Key="TopPanelMenu" TargetType="{x:Type ContextMenu}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Background" Value="{DynamicResource PopupBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource PopupBorderBrush}" />
        <Setter Property="BorderThickness" Value="{DynamicResource PopupBorderThickness}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ContextMenu}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            Grid.IsSharedSizeScope="True">
                        <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                            <ItemsPresenter KeyboardNavigation.DirectionalNavigation="Cycle"/>
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TopPanelFilterToggle" TargetType="CheckBox">
        <Setter Property="MinWidth" Value="35" />
        <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
        <Setter Property="Background" Value="#990a0e1e" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Margin" Value="10,6,0,6" />
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border Background="{TemplateBinding Background}" BorderThickness="0"
                            CornerRadius="3">
                        <StackPanel Orientation="Horizontal" Margin="6,0,6,0">
                            <TextBlock Text="&#xef29;"
                                       FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                                       VerticalAlignment="Center" HorizontalAlignment="Center"
                                       Foreground="{TemplateBinding Foreground}"/>
                            <TextBlock Text="{DynamicResource LOCFilterActiveLabel}"
                                       Style="{DynamicResource BaseTextBlockStyle}"
                                       Margin="3,0,0,0" VerticalAlignment="Center"
                                       Name="TextFilter" />
                        </StackPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Tag" Value="{StaticResource True}">
                            <Setter Property="Visibility" Value="Visible" TargetName="TextFilter" />
                            <Setter Property="Background" Value="{DynamicResource NormalBrush}" />
                        </Trigger>
                        <Trigger Property="Tag" Value="{StaticResource False}">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="TextFilter" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Foreground" Value="{DynamicResource GlyphBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="TopPanelNotificationsToggle" TargetType="ToggleButton">
        <Setter Property="Margin" Value="10,6,0,6" />
        <Setter Property="MinWidth" Value="35" />
        <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
        <Setter Property="Foreground" Value="{DynamicResource GlyphBrush}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border Background="Transparent">
                        <Grid>
                            <TextBlock Text="&#xeea3;" FontFamily="{DynamicResource FontIcoFont}" FontSize="24"
                                       Foreground="{TemplateBinding Foreground}"
                                       HorizontalAlignment="Center"/>
                            <Border CornerRadius="3" Width="15" Height="15"
                                    Margin="20,0,0,0" Background="OrangeRed"
                                    HorizontalAlignment="Right" VerticalAlignment="Bottom">
                                <TextBlock Text="{Api Notifications.Count}" FontSize="12"
                                           Foreground="{DynamicResource TextBrush}"
                                           HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </Border>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Api Notifications.Count}" Value="0">
                <Setter Property="Visibility" Value="Collapsed"/>
            </DataTrigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type TopPanel}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TopPanel}">
                    <Border Height="50" BorderBrush="{DynamicResource PanelSeparatorBrush}"
                            Background="{TemplateBinding Background}"
                            d:DesignWidth="1280"
                            d:DataContext="{x:Static DesignMainViewModel.DesignIntance}">
                        <Border.Style>
                            <Style TargetType="Border">
                                <Setter Property="BorderThickness" Value="0,0,0,1" />
                                <Style.Triggers>
                                    <DataTrigger Binding="{Settings ShowPanelSeparators}" Value="False">
                                        <Setter Property="BorderThickness" Value="0" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Border.Style>
                        <DockPanel Margin="0,3,110,3">
                            <Border x:Name="PART_ElemMainMenu" Background="Transparent"
                                    DockPanel.Dock="Left" Margin="5,0,0,0" Cursor="Hand"
                                    WindowChrome.IsHitTestVisibleInChrome="True">
                                <Image Source="{ThemeFile 'Images/applogo.png'}"
                                       Height="40" RenderOptions.BitmapScalingMode="Fant"
                                       Margin="10,0,5,0"/>
                            </Border>

                            <SearchBox x:Name="PART_TextMainSearch"
                                        Margin="5,6,0,6" DockPanel.Dock="Left"
                                        WindowChrome.IsHitTestVisibleInChrome="True"
                                        Width="300" />

                            <StackPanel x:Name="PART_PanelMainItems" Orientation="Horizontal"
                                        VerticalAlignment="Stretch" Margin="0,6,0,6"/>

                            <CheckBox x:Name="PART_ToggleFilter" ToolTip="{DynamicResource LOCFilters}"
                                      Style="{DynamicResource TopPanelFilterToggle}"
                                      DockPanel.Dock="Left" />

                            <CheckBox x:Name="PART_ToggleNotifications"
                                      Style="{DynamicResource TopPanelNotificationsToggle}"
                                      DockPanel.Dock="Left" />

                            <StackPanel x:Name="PART_PanelMainPluginItems" Orientation="Horizontal"
                                        VerticalAlignment="Stretch" Margin="15,6,15,6"
                                        DockPanel.Dock="{Settings PluginTopPanelAlignment}"/>

                            <StackPanel Orientation="Horizontal" DockPanel.Dock="Left"
                                        HorizontalAlignment="Center" Margin="0,5,0,5">
                                <Grid MaxWidth="600" MinWidth="300">
                                    <ProgressBar Name="PART_ProgressGlobal" />
                                    <TextBlock Name="PART_TextProgressText"
                                               VerticalAlignment="Center" HorizontalAlignment="Center"
                                               Style="{DynamicResource BaseTextBlockStyle}" Margin="5,0,5,0" />
                                </Grid>

                                <Button Name="PART_ButtonProgressCancel"
                                        Content="{DynamicResource LOCCancelLabel}"
                                        WindowChrome.IsHitTestVisibleInChrome="True"
                                        Margin="5,0,0,0" />
                            </StackPanel>                    
                        </DockPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>