<Page x:Class="ForzaUI.Scenes.Anthem.A_CarHornSelect"
      xmlns:local="clr-namespace:ForzaUI"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      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="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">
    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Menu}"/>
    </local:UIPageTransitionManager.TransitionManager>

    <Page.Resources>
        <ResourceDictionary>
            <Style x:Key="A_Style_ContentControl_NewCarHorn"
                   TargetType="ContentControl"
                   BasedOn="{StaticResource A_Style_MarketplaceBlammo}">
                <Setter Property="Visibility"
                        Value="Collapsed" />
                <Style.Triggers>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding IsLocked}"
                                       Value="False" />
                            <Condition Binding="{Binding IsNew}"
                                       Value="True" />
                        </MultiDataTrigger.Conditions>
                        <Setter Property="Visibility"
                                Value="Visible" />
                    </MultiDataTrigger>
                </Style.Triggers>
            </Style>
            <Style x:Key="A_Style_CarHorn_HighlightingText" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
                <Setter Property="Color" Value="{StaticResource A_Color_ItemStatusBackground}" />
                <Setter Property="CapHeight" Value="16" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}"
                                 Value="True">
                        <Setter Property="Color"
                                Value="{StaticResource A_Color_TextMenu_Text_Highlighted}" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            <Style x:Key="A_Style_CarHorn_HighlightingMaterial" TargetType="local:FZMaterial">
                <Setter Property="Color" Value="{StaticResource A_Color_ItemStatusBackground}" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}"
                                 Value="True">
                        <Setter Property="Color"
                                Value="{StaticResource A_Color_TextMenu_Text_Highlighted}" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            <DataTemplate x:Key="A_DataTemplate_HornItem">
                <Grid>
                    <local:FZMaterial x:Name="RarityTag"
                                  local:RoutedEventCommand.Action="{Binding ElementName=MouseLeftButtonUpCommand}"
                                  Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterLeftOnly}"
                                  Color="{Binding Rarity, Converter={StaticResource A_Converter_RarityToColor}}"
                                  Width="28"
                                  Margin="0,0,-0.5,0"
                                  HorizontalAlignment="Left"/>
                    <local:FZMaterial x:Name="FZMaterial_Streak"
                                  Style="{DynamicResource A_Style_FZMaterial_HighlightShadow_Dynamic}"
                                  local:RoutedEventCommand.Action="{Binding ElementName=MouseLeftButtonUpCommand}">
                        <Grid Focusable="True"
                              Margin="{StaticResource A_Thickness_TextMenu_Content_Margin}"
                              Height="{StaticResource A_Double_TextMenu_Height_Default}">
                            <local:FZTextBlock Text="{Binding DisplayName, Converter={StaticResource A_StringToUpper}}"
                                               Style="{StaticResource A_Style_FZTextBlock_OptionText}"
                                               Margin="24,0,0,0"
                                               HorizontalAlignment="Left" />
                            <StackPanel Orientation="Horizontal"
                                        VerticalAlignment="Center"
                                        HorizontalAlignment="Right">
                                <local:FZTextBlock Style="{StaticResource A_Style_CarHorn_HighlightingText}"
                                                   Text="{Binding Source={local:Loc Upgrades_flow.IDS_Installed}, Mode=OneWay, Converter={StaticResource A_StringToUpper}}"
                                                   VerticalAlignment="Center"
                                                   Visibility="{Binding IsCurrent, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
                                <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Anthem/A_Tick.png"
                                                  Style="{StaticResource A_Style_CarHorn_HighlightingMaterial}"
                                                  Margin="10,0,0,0"
                                                  Width="28"
                                                  Height="21"
                                                  Visibility="{Binding IsCurrent, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
                                <ContentControl Style="{StaticResource A_Style_ContentControl_NewCarHorn}"
                                                Margin="10,0,0,0"
                                                Tag="{x:Static local:MarketplaceBlammoType.New}" />
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TextMenu_LockIcon}"
                                                  Visibility="{Binding IsLocked, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                                                  Margin="10,0,0,0" />
                            </StackPanel>
                        </Grid>
                    </local:FZMaterial>
                </Grid>
                <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource TemplatedParent}}"
                         Value="False">
                        <Setter TargetName="FZMaterial_Streak"
                        Property="CaptureSubgraph"
                        Value="False" />
                    </DataTrigger>
                </DataTemplate.Triggers>
            </DataTemplate>
        </ResourceDictionary>
    </Page.Resources>

    <Grid>
       <Control Style="{StaticResource A_Style_Control_ScreenBackground}" />

        <local:PlayerBarControl x:Name="TopBar"
                        Style="{StaticResource A_Style_PlayerBarControl}" />

        <ContentControl x:Name="BottomBar"
                        Style="{StaticResource A_Style_ButtonBar}">
            <ContentControl x:Name="DefaultHelpPanel"
                        Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}"/>
        </ContentControl>

        <Border Style="{StaticResource A_Style_Border_ScenePadding_Opus}"
                SnapsToDevicePixels="True"
                UseLayoutRounding="True">
            <StackPanel HorizontalAlignment="Center"
                        VerticalAlignment="Center">
                <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition}"
                           local:UIPageTransitionManager.TransitionIndex="0"
                           VerticalAlignment="Top">
                    <ContentControl Content="{local:Loc ScreenTitles.IDS_CarHorns}"
                                    Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                    HorizontalAlignment="Left"
                                    local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/CarHorn.png" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition}"
                           local:UIPageTransitionManager.TransitionIndex="1"
                           Focusable="False"
                           HorizontalAlignment="Left">
                    <local:ItemsSelector x:Name="PART_Categories"
                                         MaxWidth="830"
                                         ItemsSource="{Binding HornCategories}"
                                         Style="{StaticResource A_Style_ItemsSelector_TabTitle}"
                                         Focusable="False" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition}"
                           local:UIPageTransitionManager.TransitionIndex="2"
                           HorizontalAlignment="Left">
                    <local:CommonListBox x:Name="PART_List"
                                         KeyboardNavigation.DirectionalNavigation="Contained"
                                         FocusManager.IsFocusScope="True"
                                         ItemsSource="{Binding SelectedItem.Items, ElementName=PART_Categories}"
                                         Style="{StaticResource A_Style_ListBox_List_Default}"
                                         ItemContainerStyle="{StaticResource A_Style_ListBoxItem_TextMenu_WithRarityTag}"
                                         ItemTemplate="{StaticResource A_DataTemplate_HornItem}"
                                         Width="830"
                                         Height="663" />
                </Decorator>
            </StackPanel>
        </Border>
    </Grid>
</Page>
