<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"
                                       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 Width="32" Height="32" VerticalAlignment="Center">
                            <ContentControl Name="PART_ContentIcon"
                                            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" />
    </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="Background" Value="{DynamicResource NormalBrushDark}" />
        <Setter Property="Width" Value="800" />
        <Setter Property="SizeToContent" Value="Height" />
    </Style>

    <ControlTemplate x:Key="SearchWindowFilterNotification" TargetType="ContentControl">
        <Border Background="{DynamicResource NormalBrushDark}"
                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="Background" Value="Transparent" />
        <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="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="600" />
        <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="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                <Grid>
                                    <Border x:Name="HoverRectangle" IsHitTestVisible="False" Visibility="Collapsed"
                                            Background="#003f59" CornerRadius="{DynamicResource ControlCornerRadius}" />
                                    <Border x:Name="SelectedRectangle" IsHitTestVisible="False" Visibility="Collapsed"
                                            Background="#003f59" CornerRadius="{DynamicResource ControlCornerRadius}"/>
                                    <Border Padding="{TemplateBinding Padding}" Background="Transparent">
                                        <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>