<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" 
                    mc:Ignorable="d">

    <Style TargetType="{x:Type SearchWindowGameItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type SearchWindowGameItem}">
                    <DockPanel Margin="5,5,5,5">
                        <Image Name="PART_ImageGameIcon"
                               VerticalAlignment="Center" Height="32" Width="32" DockPanel.Dock="Left"
                               RenderOptions.BitmapScalingMode="Fant" >
                            <Image.Style>
                                <Style TargetType="Image">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding GameView.IsInstalled}" Value="False">
                                            <Setter Property="Opacity" Value="0.5" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Image.Style>
                        </Image>

                        <StackPanel Margin="10,0,0,0" VerticalAlignment="Center" DockPanel.Dock="Left">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Name="PART_TextName"
                                           FontWeight="SemiBold" FontSize="{DynamicResource FontSizeLarge}"
                                           VerticalAlignment="Center" Margin="0,0,5,0">
                                    <TextBlock.Style>
                                        <Style TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding GameView.IsInstalled}" Value="False">
                                                    <Setter Property="Foreground" Value="{DynamicResource TextBrushDarker}" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </TextBlock.Style>
                                </TextBlock>
                                <Image Name="PART_ImageLibraryIcon"
                                       VerticalAlignment="Center" Height="18" Width="18"
                                       Opacity="0.90"
                                       RenderOptions.BitmapScalingMode="Fant" Margin="5,0,5,0" />
                                <TextBlock Name="PART_ElemHiddenStatus"
                                           Text="&#xef22;" FontFamily="{StaticResource FontIcoFont}" FontSize="16"
                                           VerticalAlignment="Center" Margin="5,0,5,0" />
                            </StackPanel>

                            <ItemsControl Name="PART_ItemsAdditionalInfo" Margin="0,5,0,0">
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock Foreground="{DynamicResource TextBrushDarker}">
                                            <TextBlock.Style>
                                                <Style TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
                                                    <Setter Property="Margin" Value="5,0,0,0" />
                                                    <Setter Property="Text" Value="{Binding '', StringFormat='- {0}'}" />
                                                    <Style.Triggers>
                                                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}" Value="{x:Null}">
                                                            <Setter Property="Margin" Value="0" />
                                                            <Setter Property="Text" Value="{Binding}" />
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </TextBlock.Style>
                                        </TextBlock>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Horizontal" />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </ItemsControl>
                        </StackPanel>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <DataTemplate x:Key="SearchWindowGameItemTemplate">
        <SearchWindowGameItem />
    </DataTemplate>
    
    <Style TargetType="{x:Type SearchWindowSearchItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type SearchWindowSearchItem}">
                    <StackPanel Orientation="Horizontal" Margin="5,2,5,2">
                        <Viewbox MaxWidth="80" Height="32" VerticalAlignment="Center">
                            <ContentControl Name="PART_ContentIcon" MaxWidth="80"
                                            Focusable="False" VerticalAlignment="Center" Margin="4" />
                        </Viewbox>
                        <StackPanel Margin="10,0,0,0" VerticalAlignment="Center" >
                            <TextBlock Name="PART_TextName"
                                       VerticalAlignment="Center" FontWeight="Normal" FontSize="{DynamicResource FontSizeLarge}" />
                            <TextBlock Name="PART_TextDescription"
                                       Foreground="{DynamicResource TextBrushDarker}"
                                       Margin="0,5,0,0" VerticalAlignment="Center"/>
                        </StackPanel>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <DataTemplate x:Key="SearchWindowSearchItemTemplate">
        <SearchWindowSearchItem />
    </DataTemplate>

    <Style x:Key="SearchWindowSearchLabelButton" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
        <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
        <Setter Property="Margin" Value="0,0,5,0" />
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding}" TextTrimming="CharacterEllipsis" MaxWidth="100" Margin="0,0,4,0"/>
                        <TextBlock Text="&#xeee4;" FontFamily="{StaticResource FontIcoFont}" />
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SearchWindowActionButton" TargetType="ToggleButton" BasedOn="{StaticResource {x:Type ToggleButton}}">
        <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
        <Setter Property="Margin" Value="5,0,5,0" />
        <Setter Property="Padding" Value="16,5,16,5" />
    </Style>

    <Style x:Key="SearchWindowInfoButton" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
        <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
        <Setter Property="FontSize" Value="20" />
        <Setter Property="Margin" Value="10,0,5,0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Content" Value="&#xef50;" />
        <Setter Property="FontFamily" Value="{StaticResource FontIcoFont}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
    </Style>

    <Style x:Key="SearchWindowSettignsButton" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
        <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
        <Setter Property="FontSize" Value="20" />
        <Setter Property="Margin" Value="5,0,5,0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Content" Value="&#xefb0;" />
        <Setter Property="FontFamily" Value="{StaticResource FontIcoFont}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
    </Style>

    <Style x:Key="SearchWindowStyle" TargetType="WindowBase" BasedOn="{StaticResource StandardWindowStyle}">
        <Setter Property="Width" Value="720" />
        <Setter Property="SizeToContent" Value="Height" />
    </Style>

    <ControlTemplate x:Key="SearchWindowFilterNotification" TargetType="ContentControl">
        <Border Background="{DynamicResource TextBoxIsSelectedBackgroundBrush}"
                CornerRadius="{DynamicResource ControlCornerRadius}"
                HorizontalAlignment="Stretch">
            <TextBlock FontSize="{DynamicResource FontSizeLarge}" VerticalAlignment="Center"
                       Style="{DynamicResource BaseTextBlockStyle}"
                       Text="{TemplateBinding Content}" Margin="10,0,0,0" />
        </Border>
    </ControlTemplate>

    <Style x:Key="SearchWindowSearchBox" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
        <Setter Property="FontSize" Value="{DynamicResource FontSizeLarger}" />
        <Setter Property="VerticalAlignment" Value="Center" />
    </Style>
    
    <Style x:Key="SearchWindowSearchDescription" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
        <Setter Property="Margin" Value="5,0,0,0" />
        <Setter Property="Foreground" Value="LightGray" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}" />
    </Style>

    <Style x:Key="SearchWindowSearchHint" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
        <Setter Property="Margin" Value="10" />
        <Setter Property="TextWrapping" Value="Wrap" />
        <Setter Property="Foreground" Value="LightGray" />
        <Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}" />
    </Style>

    <Style x:Key="SearchWindowList" TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}">
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="MaxHeight" Value="520" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Margin" Value="0,20,0,0" />
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="{x:Type ListBoxItem}">
                    <Setter Property="SnapsToDevicePixels" Value="True" />
                    <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
                    <Setter Property="OverridesDefaultStyle" Value="True" />
                    <Setter Property="Padding" Value="3" />
                    <Setter Property="Margin" Value="0" />
                    <Setter Property="HorizontalAlignment" Value="Stretch" />
                    <Setter Property="VerticalAlignment" Value="Stretch" />
                    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                    <Setter Property="Cursor" Value="Hand" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                <Grid Margin="10,0,5,0">
                                    <Border x:Name="HoverRectangle" IsHitTestVisible="False" Visibility="Collapsed" Opacity="0.20"
                                            Background="{DynamicResource MenusHoverBrush}" CornerRadius="{DynamicResource ControlCornerRadius}" />
                                    <Border x:Name="SelectedRectangle" IsHitTestVisible="False" Visibility="Collapsed"
                                            Background="{DynamicResource MenusHoverBrush}" CornerRadius="{DynamicResource ControlCornerRadius}"/>
                                    <Border Padding="{TemplateBinding Padding}" Background="Transparent"
                                            BorderThickness="0,1,0,0" BorderBrush="#3b393c">
                                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                              Margin="3,0,0,0" />
                                    </Border>
                                </Grid>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsFocused" Value="True">
                                        <Setter Property="Visibility" Value="Visible" TargetName="SelectedRectangle" />
                                    </Trigger>
                                    <Trigger Property="IsSelected" Value="true">
                                        <Setter Property="Visibility" Value="Visible" TargetName="SelectedRectangle" />
                                    </Trigger>
                                    <MultiTrigger>
                                        <MultiTrigger.Conditions>
                                            <Condition Property="IsMouseOver" Value="True" />
                                            <Condition Property="Selector.IsSelected" Value="False" />
                                        </MultiTrigger.Conditions>
                                        <Setter Property="Visibility" Value="Visible" TargetName="HoverRectangle" />
                                    </MultiTrigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>