<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="ForzaUI.Scenes.Anthem.A_CarHornSelect"
    Style="{StaticResource A_Style_Page_Generic}"
    DataContext="{Binding RelativeSource={RelativeSource Self}}">
    <UIPageTransitionManager.TransitionManager>
        <UIPageTransitionManager
            Preset="{StaticResource A_UIPageTransitionManagerPreset_Menu}" />
    </UIPageTransitionManager.TransitionManager>
    <Page.Resources>
        <ResourceDictionary>
            <Double x:Key="A_Double_CarHornList_Width">875</Double>
            <Style x:Key="A_Style_ContentControl_NewCarHorn" TargetType="ContentControl"
                BasedOn="{StaticResource A_Style_MarketplaceBlammo}">
                <Style.Resources>
                    <Style x:Key="A_Style_FZTextBlock_CarSelectCarouseItem_StatusText" TargetType="{x:Type FZTextBlock}"
                           BasedOn="{StaticResource H_Style_Text_StateBox_Text}">
                        <Setter Property="FontFamily" Value="Horizon_A"/>
                    </Style>
                </Style.Resources>

                <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_ContentControl_PurchasableCarHornCredits" TargetType="ContentControl"
                BasedOn="{StaticResource A_Style_Marketplace_Credits_Breadcrumb}">
                <Setter Property="Visibility" Value="Collapsed" />
                <Style.Triggers>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding IsPurchasable}" Value="True"/>
                            <Condition Binding="{Binding IsLocked}" Value="True"/>
                        </MultiDataTrigger.Conditions>
                        <Setter Property="Visibility" Value="Visible" />
                    </MultiDataTrigger>
                </Style.Triggers>
            </Style>
            <Style x:Key="A_Style_FZMaterial_CarHorn_PadLock" TargetType="{x:Type FZMaterial}"
                   BasedOn="{StaticResource A_Style_FZMaterial_TextMenu_LockIcon}">
                <Setter Property="Visibility" Value="Collapsed"/>
                <Style.Triggers>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding Downloaded, RelativeSource={RelativeSource Self}}" Value="True"/>
                            <Condition Binding="{Binding IsLocked}" Value="True"/>
                            <Condition Binding="{Binding IsPurchasable}" Value="False"/>
                        </MultiDataTrigger.Conditions>
                        <Setter Property="Visibility" Value="Visible"/>
                    </MultiDataTrigger>
                </Style.Triggers>
            </Style>
                <FZMaterialPresetRoundtangleStroke
                    x:Key="A_FZMaterialPresetRoundtangleStroke_TickStroke"
                    CornerRadius="{StaticResource H_CornerRadius_All_2px}"
                    Thickness="2" />
            <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>
            <Style x:Key="A_FZTextBlock_CarHorn_DisplayName" TargetType="FZTextBlock"
                BasedOn="{StaticResource H_Style_Text_ListOption_B_16px}">
                <Style.Triggers>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding IsLocked}" Value="True"/>
                            <Condition Binding="{Binding IsPurchasable}" Value="False"/>
                            <Condition Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" Value="False"/>
                        </MultiDataTrigger.Conditions>
                        <Setter Property="Color" Value="{StaticResource H_Color_Primary_Grey_70pc}"/>
                    </MultiDataTrigger>
                </Style.Triggers>
            </Style>
            <DataTemplate
                x:Key="A_DataTemplate_HornItem">
                <Grid
                    RoutedEventCommand.Action="{Binding ElementName=MouseLeftButtonUpCommand}">
                    <Grid
                        Focusable="True"
                        Margin="10,0"
                        Height="{StaticResource A_Double_TextMenu_Height_Default}">
                        <StackPanel
                            Orientation="Horizontal"
                            VerticalAlignment="Center">
                            <FZMaterial
                                x:Name="RarityTag"
                                RoutedEventCommand.Action="{Binding ElementName=MouseLeftButtonUpCommand}"
                                Color="{Binding Rarity, Converter={StaticResource A_Converter_RarityToColor}}"
                                Width="138"
                                Height="34"
                                VerticalAlignment="Center">
                                <FZTextBlock Text="{Binding Rarity, Converter={StaticResource A_Converter_RarityToUpperNameString}}"
                                                 VerticalAlignment="Center"
                                                 HorizontalAlignment="Center"
                                                 Color="{StaticResource H_Color_Primary_White}"
                                                 CapHeight="18"
                                                 Margin="4"
                                                 FontFamily="Horizon_A"/>
                            </FZMaterial>      
                            
                            <FZTextBlock
                                Text="{Binding DisplayName}"
                                HorizontalAlignment="Left"
                                Style="{StaticResource A_FZTextBlock_CarHorn_DisplayName}" 
                                Margin="14,1,0,0"/>
                        </StackPanel>
                        <StackPanel
                            Orientation="Horizontal"
                            VerticalAlignment="Center"
                            HorizontalAlignment="Right">
                            <FZMaterial
                                x:Name="Installed_Container"
                                Color="{StaticResource H_Color_Primary_Green}"
                                Width="28"
                                Height="28"
                                Preset="{StaticResource H_Roundtangle_Outer_2px}"
                                Visibility="{Binding IsCurrent, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                                <Grid>
                                    <FZMaterial x:Name="Tick Stroke"
                                                Preset="{StaticResource A_FZMaterialPresetRoundtangleStroke_TickStroke}"
                                                Color="{StaticResource H_Color_Primary_Black}"/>
                                    <FZMaterial
                                        ImageSource="/ForzaUI;component/Textures/Anthem/Icons/Tick.png"
                                        Style="{StaticResource A_Style_CarHorn_HighlightingMaterial}"
                                        Width="20"
                                        Height="20"
                                        Color="{StaticResource H_Color_Primary_Black}" />
                                </Grid>
                            </FZMaterial>
                            <ContentControl
                                Style="{StaticResource A_Style_ContentControl_NewCarHorn}"
                                Margin="10,0,0,0"
                                Tag="{x:Static local:MarketplaceBlammoType.New}"
                                x:Name="New_Box" />
                            <ContentControl x:Name="Cost"
                                            Content="{Binding CreditsCost}"
                                            Style="{StaticResource A_Style_ContentControl_PurchasableCarHornCredits}"/>
                            <FZMaterial
                                Style="{StaticResource A_Style_FZMaterial_CarHorn_PadLock}"
                                Margin="10,0,0,0" />
                        </StackPanel>
                    </Grid>
                </Grid>
            </DataTemplate>
        </ResourceDictionary>
    </Page.Resources>
    <Grid>
        <Control
            Style="{StaticResource A_Style_Control_ScreenBackground}" />
        <PlayerBarControl
            x:Name="TopBar"
            Style="{StaticResource A_Style_PlayerBarControl}"/>
        <ContentControl
            x:Name="BottomBar"
            Style="{StaticResource A_Style_ButtonBar}">
            <ContentControl
                x:Name="PART_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"
                Margin="0,0,0,0">
                <Decorator
                    Style="{StaticResource A_Style_FrameworkElement_DefaultTransition}"
                    UIPageTransitionManager.TransitionIndex="0"
                    VerticalAlignment="Top">
                    <ContentControl
                        Content="{Loc ScreenTitles.IDS_CarHorns}"
                        Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                        HorizontalAlignment="Left"
                        BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/CarHorn.png"
                        x:Name="Screen_Title" />
                </Decorator>
                <Decorator
                    Style="{StaticResource A_Style_FrameworkElement_DefaultTransition}"
                    UIPageTransitionManager.TransitionIndex="1"
                    Focusable="False"
                    HorizontalAlignment="Left">
                    <FZTabButtonsSelector
                        x:Name="PART_Categories"
                        ItemsSource="{Binding HornCategories}"
                        Style="{StaticResource H_Style_TabBar}"
                        Focusable="False"
                        SelectedIndex="0"
                        Width="{StaticResource A_Double_CarHornList_Width}"
                        HorizontalContentAlignment="Center"
                        HorizontalAlignment="Center"/>
                </Decorator>
                <Decorator
                    Style="{StaticResource A_Style_FrameworkElement_DefaultTransition}"
                    UIPageTransitionManager.TransitionIndex="2"
                    HorizontalAlignment="Left">
                    <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_Gaps}"
                        ItemTemplate="{StaticResource A_DataTemplate_HornItem}"          
                        Width="{StaticResource A_Double_CarHornList_Width}"
                        Height="702" />
                </Decorator>
            </StackPanel>
        </Border>
    </Grid>
</Page>