<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 Main}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Main}">
                    <Grid x:Name="PART_MainHost"
                          d:DesignWidth="{StaticResource DesignWidth}"
                          d:DesignHeight="{StaticResource DesignHeight}"
                          d:DataContext="{x:Static DesignMainViewModel.DesignIntance}">
                        <Grid x:Name="PART_ViewHost" Background="{DynamicResource MainBackgourndBrush}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <Grid Grid.Row="0" Background="{DynamicResource TopBarBackgroundBrush}"
                                  Height="110">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="100" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="4*" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="100" />
                                </Grid.ColumnDefinitions>

                                <ToggleButton x:Name="PART_ToggleFilterRecently" Grid.Column="1"
                                            Style="{DynamicResource ToggleButtonTopFilter}"
                                            Content="{DynamicResource LOCQuickFilterRecentlyPlayed}" Margin="5"/>
                                <ToggleButton x:Name="PART_ToggleFilterFavorite"  Grid.Column="2"
                                            Style="{DynamicResource ToggleButtonTopFilter}"
                                            Content="{DynamicResource LOCQuickFilterFavorites}" Margin="5" />
                                <ToggleButton x:Name="PART_ToggleFilterMostPlayed" Grid.Column="3"
                                            Style="{DynamicResource ToggleButtonTopFilter}"
                                            Content="{DynamicResource LOCQuickFilterMostPlayed}" Margin="5"  />
                                <ToggleButton x:Name="PART_ToggleFilterAll" Grid.Column="4"
                                            Style="{DynamicResource ToggleButtonTopFilter}"
                                            Content="{DynamicResource LOCQuickFilterAllGames}" Margin="5"  />

                                <ContentControl x:Name="PART_ElemBatteryStatus" Focusable="False" FontSize="42"
                                            VerticalAlignment="Center" Margin="10,0,10,0"
                                            Grid.Column="6">
                                    <ContentControl.Style>
                                        <Style TargetType="ContentControl">
                                            <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding PowerStatus.Charge}" Value="Critical">
                                                    <Setter Property="Content" Value="{DynamicResource BatteryStatusCritical}" />
                                                    <Setter Property="Foreground" Value="Red" />
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding PowerStatus.Charge}" Value="Low">
                                                    <Setter Property="Content" Value="{DynamicResource BatteryStatusLow}" />
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding PowerStatus.Charge}" Value="Medium">
                                                    <Setter Property="Content" Value="{DynamicResource BatteryStatusMedium}" />
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding PowerStatus.Charge}" Value="High">
                                                    <Setter Property="Content" Value="{DynamicResource BatteryStatusHigh}" />
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding PowerStatus.IsCharging}" Value="True">
                                                    <Setter Property="Content" Value="{DynamicResource BatteryStatusCharging}" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </ContentControl.Style>
                                </ContentControl>

                                <TextBlock x:Name="PART_TextBatteryPercentage" Style="{DynamicResource TextBlockBaseStyle}"
                                       VerticalAlignment="Center" Margin="0,0,20,0"
                                       Grid.Column="7"/>

                                <TextBlock x:Name="PART_TextClock" Style="{DynamicResource TextBlockBaseStyle}"
                                       VerticalAlignment="Center" Margin="20,0,20,0"
                                       Grid.Column="8"/>

                                <ButtonEx x:Name="PART_ButtonNotifications" VerticalAlignment="Center"
                                          Margin="10,0,10,0" Height="48" Width="48"
                                          Grid.Column="9">
                                    <Button.Content>
                                        <Grid>
                                            <TextBlock Text="&#xeea3;" FontFamily="{StaticResource FontIcoFont}"
                                                       HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2"
                                                       Foreground="White" FontSize="30" />
                                            <TextBlock Text="&#x25CF;" Foreground="{DynamicResource GlyphBrush}"
                                                       HorizontalAlignment="Right" VerticalAlignment="Bottom"
                                                       FontSize="24" Margin="0,0,5,0" />
                                        </Grid>
                                    </Button.Content>
                                    <Button.Style>
                                        <Style TargetType="Button" BasedOn="{StaticResource ButtonTopMenu}">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Api Notifications.Count}" Value="0">
                                                    <Setter Property="Visibility" Value="Hidden"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Button.Style>
                                </ButtonEx>

                                <ButtonEx x:Name="PART_ButtonMainMenu" VerticalAlignment="Center"
                                          Style="{DynamicResource ButtonTopMenu}"
                                          Margin="10,0,10,0" Height="48"
                                          Grid.Column="10">
                                    <Button.Content>
                                        <Image RenderOptions.BitmapScalingMode="Fant" Margin="2"
                                           Source="{ThemeFile 'Images/applogo_clean.png'}" />
                                    </Button.Content>
                                </ButtonEx>
                            </Grid>

                            <DockPanel Grid.Row="1">
                                <Filters x:Name="PART_ElemFilters"
                                         DockPanel.Dock="Left" Focusable="False" />

                                <FiltersAdditional x:Name="PART_ElemFiltersAdditional"
                                                   DockPanel.Dock="Left" Focusable="False" />

                                <ContentControl x:Name="PART_ContentFilterItems"
                                            DockPanel.Dock="Left" Focusable="False" />

                                <ListBoxEx x:Name="PART_ListGameItems" Margin="25,0,25,0"
                                           Background="Transparent" BorderThickness="0"
                                           DockPanel.Dock="Right"
                                           KeyboardNavigation.DirectionalNavigation="Once"
                                           ItemContainerStyle="{DynamicResource ListGameItem}">
                                </ListBoxEx>
                            </DockPanel>

                            <TextBlock Grid.Row="1" FontSize="40"
                                       Text="{DynamicResource LOCNoGamesFound}"
                                       TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center">
                                <TextBlock.Style>
                                    <Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
                                        <Setter Property="Visibility" Value="Collapsed" />
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding Items.Count, ElementName=PART_ListGameItems}" Value="0">
                                                <Setter Property="Visibility" Value="Visible" />
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </TextBlock.Style>
                            </TextBlock>

                            <Grid Grid.Row="2" Background="{DynamicResource TopBarBackgroundBrush}"
                              Height="100">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="100" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="100" />
                                </Grid.ColumnDefinitions>

                                <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
                                    <!--Install-->
                                    <Button x:Name="PART_ButtonInstall" Focusable="False" 
                                    Style="{DynamicResource ButtonBottomMenu}">
                                        <Button.Content>
                                            <StackPanel Orientation="Horizontal">
                                                <ContentControl Style="{DynamicResource ButtonPromptX}"
                                                                Height="30" VerticalAlignment="Center" Margin="0,0,10,0"/>
                                                <TextBlock Text="{DynamicResource LOCInstallGame}" Style="{DynamicResource TextBlockBaseStyle}"
                                                       VerticalAlignment="Center"/>
                                            </StackPanel>
                                        </Button.Content>
                                    </Button>

                                    <!--Play-->
                                    <Button x:Name="PART_ButtonPlay" Focusable="False"
                                    Style="{DynamicResource ButtonBottomMenu}">
                                        <Button.Content>
                                            <StackPanel Orientation="Horizontal">
                                                <ContentControl Style="{DynamicResource ButtonPromptX}"
                                                                Height="30" VerticalAlignment="Center" Margin="0,0,10,0"/>
                                                <TextBlock Text="{DynamicResource LOCPlayGame}" Style="{DynamicResource TextBlockBaseStyle}"
                                                       VerticalAlignment="Center"/>
                                            </StackPanel>
                                        </Button.Content>
                                    </Button>

                                    <!--Details-->
                                    <Button x:Name="PART_ButtonDetails" Focusable="False"
                                    Style="{DynamicResource ButtonBottomMenu}">
                                        <Button.Content>
                                            <StackPanel Orientation="Horizontal">
                                                <ContentControl Style="{DynamicResource ButtonPromptA}"
                                                                Height="30" VerticalAlignment="Center" Margin="0,0,10,0"/>
                                                <TextBlock Text="{DynamicResource LOCGameDetails}" Style="{DynamicResource TextBlockBaseStyle}"
                                                       VerticalAlignment="Center"/>
                                            </StackPanel>
                                        </Button.Content>
                                    </Button>

                                    <!--Options-->
                                    <Button x:Name="PART_ButtonGameOptions" Focusable="False"
                                        Style="{DynamicResource ButtonBottomMenu}">
                                        <Button.Content>
                                            <StackPanel Orientation="Horizontal">
                                                <ContentControl Style="{DynamicResource ButtonPromptStart}"
                                                                Height="30" VerticalAlignment="Center" Margin="0,0,10,0"/>
                                                <TextBlock Text="{DynamicResource LOCGameOptions}" Style="{DynamicResource TextBlockBaseStyle}"
                                                       VerticalAlignment="Center"/>
                                            </StackPanel>
                                        </Button.Content>
                                    </Button>

                                    <!--Search-->
                                    <Button x:Name="PART_ButtonSearch" Focusable="False"
                                        Style="{DynamicResource ButtonBottomMenu}">
                                        <Button.Content>
                                            <StackPanel Orientation="Horizontal">
                                                <ContentControl Style="{DynamicResource ButtonPromptY}"
                                                                Height="30" VerticalAlignment="Center" Margin="0,0,10,0"/>
                                                <TextBlock Text="{DynamicResource LOCSearchLabel}" Style="{DynamicResource TextBlockBaseStyle}"
                                                       VerticalAlignment="Center"/>
                                            </StackPanel>
                                        </Button.Content>
                                    </Button>

                                    <!--Filter-->
                                    <Button x:Name="PART_ButtonFilter" Focusable="False"
                                        Style="{DynamicResource ButtonBottomMenu}">
                                        <Button.Content>
                                            <StackPanel Orientation="Horizontal">
                                                <ContentControl Style="{DynamicResource ButtonPromptRS}"
                                                                Height="30" VerticalAlignment="Center" Margin="0,0,10,0"/>
                                                <TextBlock Text="{DynamicResource LOCFilter}" Style="{DynamicResource TextBlockBaseStyle}"
                                                       VerticalAlignment="Center"/>
                                            </StackPanel>
                                        </Button.Content>
                                    </Button>
                                </StackPanel>

                                <StackPanel Grid.Column="2" x:Name="PART_ElemSearchActive"
                                            VerticalAlignment="Top" HorizontalAlignment="Stretch"
                                            Margin="0,15,0,0">
                                    <TextBlock  FontSize="18"                                                
                                                TextAlignment="Center"
                                                Style="{DynamicResource TextBlockBaseStyle}"
                                                Text="Showing search results for:"/>
                                    <TextBlock  Foreground="White"
                                                TextAlignment="Center"
                                                Style="{DynamicResource TextBlockBaseStyle}"
                                                Text="{Binding AppSettings.Fullscreen.FilterSettings.Name}"/>
                                </StackPanel>
                                

                                <TextBlock Grid.Column="2" x:Name="PART_ElemExtraFilterActive"
                                       FontSize="20"
                                       VerticalAlignment="Center" HorizontalAlignment="Stretch"
                                       TextAlignment="Center"
                                       Style="{DynamicResource TextBlockBaseStyle}"
                                       Text="{DynamicResource LOCGameListFiltered}"/>

                                <StackPanel x:Name="PART_ElemProgressIndicator" Orientation="Horizontal"
                                        Grid.Column="3" VerticalAlignment="Center">
                                    <TextBlock x:Name="PART_TextProgressTooltip" 
                                           Margin="0,0,15,0" FontSize="20" VerticalAlignment="Center"
                                           Style="{DynamicResource TextBlockBaseStyle}"/>
                                    <ContentControl Style="{DynamicResource ProgressIndicator}" Focusable="False"
                                                Height="38" Width="38" VerticalAlignment="Center" />
                                </StackPanel>
                            </Grid>
                        </Grid>

                        <Border Background="{DynamicResource OverlayBrush}"
                                Visibility="{Binding MainMenuVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>

                        <GameDetails x:Name="PART_ElemGameDetails" Grid.RowSpan="3"
                                     HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>

                        <Notifications x:Name="PART_ElemNotifications" Grid.RowSpan="3"
                                       VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
                        <MainMenu x:Name="PART_ElemMainMenu" Grid.RowSpan="3"
                                  VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
                        <SettingsMenu x:Name="PART_ElemSettingsMenu" Grid.RowSpan="3"                                      
                                      HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                        <GameMenu x:Name="PART_ElemGameMenu" Grid.RowSpan="3"
                                  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>