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

    <Page.Resources>
        <ResourceDictionary>
            <System:Double x:Key="A_Double_CarRestrictions_TileSizeWithPadding">246</System:Double>
            <System:Double x:Key="A_Double_CarRestrictions_TileSizeWithPadding_Mfr">123</System:Double>
            <System:Double x:Key="A_Double_CarRestritions_TilePanelHeight">492</System:Double>
            <System:Double x:Key="A_Double_CarRestritions_TilePanelWidth">984</System:Double>
            <System:Double x:Key="A_Double_CarRestritions_TilePanelHeightWithExternalPadding">520</System:Double>

            <System:Double x:Key="A_Double_CarRestritions_ScrollHeight">486</System:Double>

            <Thickness x:Key="A_Thickness_CarRestriction_ItemMargin">3,3,3,3</Thickness>
            
            <Style x:Key="A_Style_ListBoxItem_CarRestriction_Empty" TargetType="ListBoxItem">
                <Setter Property="Height" Value="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding}" />
                <Setter Property="Width" Value="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding}" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ListBoxItem}">
                            <Grid Margin="{StaticResource A_Thickness_CarRestriction_ItemMargin}">
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FlatPanel_Tile}"
                                                  Opacity="0.3"/>
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_Pill}"
                                                  Color="{StaticResource A_Color_GlassPanel_Interactive}"
                                                  Margin="1" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <ControlTemplate x:Key="A_Control_Tile_CarClass_Pills" TargetType="Control">
                    <Grid>
                    <Control x:Name="ShowdownPill" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  Height="34" Width="Auto" Margin="0,0,-2,0" Template="{StaticResource A_Control_Showdown_Pill}" Visibility="Collapsed"/>
                    <Control x:Name="OpenClassPill" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  Height="34" Width="Auto" Style="{StaticResource A_Style_Control_OnlineFlyerCarClass_AnyClass}"
                             Visibility="Collapsed"/>
                    </Grid>
                <ControlTemplate.Triggers>
                    <!--9 is actually the Id assigned to an item when it is Showdown event. Should be CarClass::Max + 1 -->
                    <DataTrigger Binding="{Binding Id}" Value="9">
                        <Setter Property="Visibility" TargetName="ShowdownPill" Value="Visible"/>
                    </DataTrigger>
                    <!-- -1 is actually the Id assigned to an item when it is Open Class event. Should be CarClass::None -->
                    <DataTrigger Binding="{Binding Id}" Value="-1">
                        <Setter Property="Visibility" TargetName="OpenClassPill" Value="Visible"/>
                    </DataTrigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
            
            <Style x:Key="A_Style_CarClassRestriction_CarClass_Pill" TargetType="Control">
                <Setter Property="Visibility" Value="Collapsed"/>
                <Setter Property="Template" Value="{StaticResource A_Control_Tile_CarClass_Pills}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SceneEnum, RelativeSource={RelativeSource AncestorType=Page} }" Value="{x:Static local:SceneEntryEnum.CarClassRestrictionsSelect}">
                        <Setter Property="Visibility" Value="Visible"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            
            <Style x:Key="A_Style_ListBoxItem_CarRestriction_Empty_Mfr" TargetType="ListBoxItem" BasedOn="{StaticResource A_Style_ListBoxItem_CarRestriction_Empty}">
                <Setter Property="Height" Value="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding_Mfr}" />
                <Setter Property="Width" Value="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding_Mfr}" />
            </Style>

            <Style x:Key="A_Style_ListBoxItem_CarRestriction" TargetType="ListBoxItem">
                <Setter Property="Height" Value="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding}" />
                <Setter Property="Width" Value="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding}" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ListBoxItem">
                            <Grid x:Name="Grid_Container" RenderTransformOrigin="0.5,0.5"
                                  Margin="{StaticResource A_Thickness_CarRestriction_ItemMargin}">
                                <Grid.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform/>
                                        <SkewTransform/>
                                        <RotateTransform/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </Grid.RenderTransform>

                                <local:FZMaterial x:Name="DropShadow" Style="{StaticResource A_Style_FZMaterial_TileDropShadow}" IsHitTestVisible="False"/>

                                <local:RoutedEventCommand x:Name="SelectItemRoutedEventCommand"
                                                          RoutedEvent="UIElement.MouseLeftButtonUp"
                                                          Command="{Binding SelectCommand, RelativeSource={RelativeSource AncestorType=Page}}" />

                                <Grid x:Name="ScaledContainer"
                                      RenderTransformOrigin="0.5,0.5"
                                      local:ZPanel.ZOffset="0"
                                      Effect="{StaticResource A_MotionBlurEffect}"
                                      local:RoutedEventCommand.Action="{Binding ElementName=SelectItemRoutedEventCommand}">
                                    <Grid.RenderTransform>
                                        <ScaleTransform />
                                    </Grid.RenderTransform>

                                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_MotionBlurExpander}"/>

                                    <local:FZMaterial x:Name="Background" Style="{StaticResource A_Style_FZMaterial_GlassPanel_Pill}"
                                                      Color="{StaticResource A_Color_GlassPanel_NonInteractive}"/>

                                    <Grid x:Name="ImageBorder" Margin="0">
                                        <ContentPresenter />
                                        <Control Style="{StaticResource A_Style_CarClassRestriction_CarClass_Pill}"
                                                 VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="10,12"/>
                                    </Grid>

                                    <ContentControl x:Name="FocusHighlight" Style="{StaticResource A_Style_ContentControl_TileSelectionStroke}" IsHitTestVisible="False"/>
                                </Grid>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsKeyboardFocused" Value="True">
                                    <Setter Property="RenderTransform" TargetName="ScaledContainer">
                                        <Setter.Value>
                                            <ScaleTransform ScaleX="1.04" ScaleY="1.04"/>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="RenderTransform" TargetName="DropShadow">
                                        <Setter.Value>
                                            <ScaleTransform ScaleX="1.04" ScaleY="1.04"/>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter TargetName="ImageBorder" Property="Margin" Value="0,0,0,0"/>
                                    <Setter Property="Panel.ZIndex" Value="20"/>
                                    <Setter Property="local:ZPanel.DisableClipping" TargetName="ScaledContainer" Value="True"/>
                                    <Setter Property="Selector.IsSelected"
                                            Value="True"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver"
                                         Value="True">
                                    <Setter Property="FocusManager.FocusedElement"
                                                 Value="{Binding RelativeSource={RelativeSource Self}}" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="A_Style_ListBoxItem_CarRestriction_Mfr" BasedOn="{StaticResource A_Style_ListBoxItem_CarRestriction}" TargetType="ListBoxItem">
                <Setter Property="Height" Value="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding_Mfr}" />
                <Setter Property="Width" Value="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding_Mfr}" />
                <Setter Property="local:BindingProxy.A">
                    <Setter.Value>
                        <System:Boolean>True</System:Boolean>
                    </Setter.Value>
                </Setter>
            </Style>

            <DataTemplate x:Key="A_DataTemplate_ListBoxItem_CarRestriction">
                <local:FZMaterial x:Name="Icon" Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerAll}"
                                  ImageSource="{Binding IconPath}"
                                  Stretch="Uniform"/>
            </DataTemplate>

            <DataTemplate x:Key="A_DataTemplate_ListBoxItem_CarRestriction_Mfr">
                <local:FZMaterial ImageSource="{Binding IconPath}"
                                  Stretch="Uniform"
                                  Margin="5"/>
            </DataTemplate>

            <Style x:Key="A_Style_FZScrollViewer_CarRestrictions_Horizontal" TargetType="{x:Type local:FZScrollViewer}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type local:FZScrollViewer}">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>

                                <ScrollBar x:Name="PART_HorizontalScrollBar" Grid.Row="1" Width="Auto" Height="12" Margin="0,-36,0,0" Orientation="Horizontal" VerticalAlignment="Center"
                                            Value="{TemplateBinding HorizontalOffset}" Minimum="0" Maximum="{TemplateBinding ScrollableWidth}" ViewportSize="{TemplateBinding ViewportWidth}"
                                            Style="{StaticResource A_Style_ScrollBar_Default}" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" />

                                <Grid Grid.Row="0">
                                    <ScrollContentPresenter Content="{TemplateBinding Content}" CanContentScroll="{TemplateBinding local:FZScrollViewer.CanContentScroll}"/>
                                </Grid>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="local:FZScrollViewer.Orientation" Value="Horizontal" />
                <Setter Property="HorizontalScrollBarVisibility" Value="{Binding (local:FZScrollViewer.HorizontalScrollBarVisibility), RelativeSource={RelativeSource TemplatedParent}}" />
                <Setter Property="VerticalScrollBarVisibility" Value="Disabled" />
            </Style>

            <Style x:Key="A_Style_FZVirtualizingTilePanel_CarRestriction" TargetType="{x:Type local:FZVirtualizingTilePanel}">
                <Setter Property="IsItemsHost" Value="True"/>
                <Setter Property="Orientation" Value="Horizontal"/>
                <Setter Property="VerticalAlignment" Value="Stretch"/>
                <Setter Property="Height" Value="{StaticResource A_Double_CarRestritions_TilePanelHeightWithExternalPadding}"/>
                <Setter Property="Width" Value="{StaticResource A_Double_CarRestritions_TilePanelWidth}"/>
                
                <!--Used to offset the position of the virtual tile panel to center it. This is needed so the shadows can have expansion space and we can't vertical align-->
                <Setter Property="Margin" Value="0,24,0,0"/>
            </Style>

            <ControlTemplate x:Key="A_ControlTemplate_ListBox_CarRestriction" TargetType="ListBox">
                <local:FZScrollViewer Width="{StaticResource A_Double_CarRestritions_TilePanelWidth}"
                                      Style="{StaticResource A_Style_FZScrollViewer_CarRestrictions_Horizontal}"
                                      TopScrollOffset="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding}"
                                      BottomScrollOffset="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding}"
                                      KeepSelectionOnScreen="True">
                    <local:FZVirtualizingTilePanel Style="{StaticResource A_Style_FZVirtualizingTilePanel_CarRestriction}"
                                                 ChildWidth="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding}"
                                                 ChildHeight="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding}"/>
                </local:FZScrollViewer>
            </ControlTemplate>

            <ControlTemplate x:Key="A_ControlTemplate_ListBox_CarRestriction_Mfr" TargetType="ListBox">
                <local:FZScrollViewer Width="{StaticResource A_Double_CarRestritions_TilePanelWidth}"
                                      Style="{StaticResource A_Style_FZScrollViewer_CarRestrictions_Horizontal}"
                                      TopScrollOffset="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding_Mfr}"
                                      BottomScrollOffset="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding_Mfr}"
                                      KeepSelectionOnScreen="True">
                    <local:FZVirtualizingTilePanel Style="{StaticResource A_Style_FZVirtualizingTilePanel_CarRestriction}"
                                                 ChildWidth="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding_Mfr}"
                                                 ChildHeight="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding_Mfr}"/>
                </local:FZScrollViewer>
            </ControlTemplate>
            
            <Style x:Key="A_Style_ListBox_CarRestriction" TargetType="ListBox">
                <Setter Property="Template" Value="{StaticResource A_ControlTemplate_ListBox_CarRestriction}" />
                <Setter Property="ItemTemplate" Value="{StaticResource A_DataTemplate_ListBoxItem_CarRestriction}" />
                <Setter Property="ItemContainerStyle" Value="{StaticResource A_Style_ListBoxItem_CarRestriction}" />
                <Setter Property="local:FZScrollViewer.CanContentScroll" Value="true"/>
                <Setter Property="local:FZScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
                <Style.Triggers>
                    <Trigger Property="Tag">
                        <Trigger.Value>
                            <local:CarRestrictionsCategory>Manufacturer</local:CarRestrictionsCategory>
                        </Trigger.Value>
                        <Setter Property="Template" Value="{StaticResource A_ControlTemplate_ListBox_CarRestriction_Mfr}"/>
                        <Setter Property="ItemTemplate" Value="{StaticResource A_DataTemplate_ListBoxItem_CarRestriction_Mfr}"/>
                        <Setter Property="ItemContainerStyle" Value="{StaticResource A_Style_ListBoxItem_CarRestriction_Mfr}" />
                    </Trigger>
                </Style.Triggers>
            </Style>
            
            <Style x:Key="A_Style_ListBox_CarRestriction_EmptyItems" TargetType="ListBox">
                <Setter Property="local:FZScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
                <Setter Property="ItemContainerStyle" Value="{StaticResource A_Style_ListBoxItem_CarRestriction_Empty}" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ListBox">
                            <Decorator ClipToBounds="True">
                                <local:FZVirtualizingTilePanel Style="{StaticResource A_Style_FZVirtualizingTilePanel_CarRestriction}"
                                                             ChildWidth="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding}"
                                                             ChildHeight="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding}"/>
                            </Decorator>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <Trigger Property="Tag">
                        <Trigger.Value>
                            <local:CarRestrictionsCategory>Manufacturer</local:CarRestrictionsCategory>
                        </Trigger.Value>
                        <Setter Property="ItemContainerStyle" Value="{StaticResource A_Style_ListBoxItem_CarRestriction_Empty_Mfr}" />
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="ListBox">
                                    <Decorator ClipToBounds="True">
                                        <local:FZVirtualizingTilePanel Style="{StaticResource A_Style_FZVirtualizingTilePanel_CarRestriction}"
                                                                     ChildWidth="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding_Mfr}"
                                                                     ChildHeight="{StaticResource A_Double_CarRestrictions_TileSizeWithPadding_Mfr}"/>
                                    </Decorator>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </Style.Triggers>
            </Style>

            <Style TargetType="ContentControl"
                   x:Key="A_Style_ContentControl_CarRestrictions_TabBarItem">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ContentControl">
                            <Grid>
                                <local:RoutedEventCommand x:Name="MouseSelectGroupRoutedEventCommand"
                                                          RoutedEvent="UIElement.MouseLeftButtonUp"
                                                          Command="{Binding MouseSelectGroupCommand, RelativeSource={RelativeSource AncestorType=Page}}"/>
                            <local:FZButton Content="{Binding Title, Converter={StaticResource A_StringToUpper}}"
                                        Style="{StaticResource A_Style_ContentControl_TabTitle_Default}"
                                        local:RoutedEventCommand.Action="{Binding ElementName=MouseSelectGroupRoutedEventCommand}"
                                        OnClickSoundName="/Master/UI/PauseMenu/HZ2_SFX_UI_PauseMenu_ChangeTab_01" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style TargetType="{x:Type local:ItemsSelector}"
                   x:Key="A_Style_Carousel4ItemList_TabBar">
                <Setter Property="FocusVisualStyle"
                        Value="{StaticResource A_Style_BlankVisualStyle}" />
                <Setter Property="IsTabStop"
                        Value="True" />
                <Setter Property="ClipToBounds"
                        Value="True" />
                <Setter Property="Width"
                        Value="824" />
                <Setter Property="Height"
                        Value="40" />
                <Setter Property="ItemContainerStyle"
                        Value="{StaticResource A_Style_ContentControl_CarRestrictions_TabBarItem}" />
                <Setter Property="PageSize"
                        Value="1" />
                <Setter Property="AlternationCount"
                        Value="10000" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <local:VirtualizingScrollPanel Style="{StaticResource A_Style_VirtualizingScrollPanel_MotionBlurScrollPanel_TabTitle}"
                                                           ItemHeight="40"
                                                           ItemWidth="206"
                                                           Margin="0,-1,0,0"
                                                           Padding="206,0,0,0" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="A_Style_FZTextBlock_CarEligibilityValue" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_Heading}">
                <Setter Property="TextAlignment" Value="Right" />
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="FontSize" Value="70" />
                <Setter Property="Color" Value="{StaticResource A_Color_SubHeader_Text}" />
                <Style.Triggers>
                    <Trigger Property="Text" Value="-1">
                        <Setter Property="Visibility" Value="Hidden" />
                    </Trigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_FZTextBlock_CarEligibilityLabel" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_Heading}">
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="TextWrapping" Value="Wrap" />
                <Setter Property="LineHeight" Value="22" />
                <Setter Property="FontFamily" Value="Horizon_C"/>
                <Setter Property="LineStackingStrategy" Value="BlockLineHeight" />
                <Setter Property="FontSize" Value="22" />
                <Setter Property="Margin" Value="12,12,24,12"/>
                <Setter Property="Color" Value="{StaticResource A_Color_SubHeader_Text}" />
            </Style>

            <Style x:Key="A_Style_FZMaterial_GlassPanel_Left_White"
                   TargetType="{x:Type local:FZMaterial}"
                   BasedOn="{StaticResource A_Style_FZMaterial_GlassPanel_Left}">
                <Setter Property="Color" Value="{StaticResource A_Color_GlassPanel_Interactive}"/>
            </Style>

            <ControlTemplate x:Key="A_Control_Eligible_Car_Panel">
                <StackPanel Margin="6,16,0,0" Orientation="Horizontal">
                    <Grid>
                        <local:FZMaterial x:Name="BackgroundPanel" Width="66" Height="66" VerticalAlignment="Center" HorizontalAlignment="Left"
                                      Style="{StaticResource A_Style_FZMaterial_FlatPanel_TileLeft}">
                            <local:FZTextBlock x:Name="EligibleCarCount"
                                           Text="{Binding NumCarsEligible}"
                                           Style="{StaticResource A_Style_FZTextBlock_CarEligibilityValue}"
                                           HorizontalAlignment="Center" FontSize="34"
                                           Color="{StaticResource A_Color_Tile_Text}" />
                        </local:FZMaterial>
                    </Grid>
                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_Pill}"
                                      Height="66" Width="420" Margin="0,0,0,0">
                        <Decorator LayoutTransform="{StaticResource A_Transform_Italic}">
                            <local:FZTextBlock x:Name="AutoshowText" Text="{local:Loc CarFlow.IDS_EligibleAutoshowCars}" Style="{StaticResource A_Style_FZTextBlock_CarEligibilityLabel}" />
                        </Decorator>
                    </local:FZMaterial>
                </StackPanel>
                <ControlTemplate.Triggers>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding SceneEnum, RelativeSource={RelativeSource AncestorType=Page}}" Value="{x:Static local:SceneEntryEnum.CarClassRestrictionsSelect}"/>
                            <Condition Binding="{Binding CampaignSetup.CarPIRestriction}" Value="-1" />
                        </MultiDataTrigger.Conditions>
                        <Setter Property="Text" Value="{local:Loc EventBlueprint.IDS_CarClassAnyDescription}" TargetName="AutoshowText"/>
                        <Setter Property="Style" Value="{StaticResource A_Style_FZMaterial_GlassPanel_Left_White}" TargetName="BackgroundPanel"/>
                        <Setter Property="Visibility" Value="Hidden" TargetName="EligibleCarCount"/>
                    </MultiDataTrigger>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding SceneEnum, RelativeSource={RelativeSource AncestorType=Page}}" Value="{x:Static local:SceneEntryEnum.CarClassRestrictionsSelect}"/>
                            <Condition Binding="{Binding CampaignSetup.IsShowdown}" Value="True"/>
                        </MultiDataTrigger.Conditions>
                        <Setter Property="Text" Value="{local:Loc EventBlueprint.IDS_CarClassShowdownDescription}" TargetName="AutoshowText"/>
                        <Setter Property="Style" Value="{StaticResource A_Style_FZMaterial_GlassPanel_Left_White}" TargetName="BackgroundPanel"/>
                        <Setter Property="Visibility" Value="Hidden" TargetName="EligibleCarCount"/>
                    </MultiDataTrigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>

            <Style x:Key="A_FrameworkElement_ShowWhenCustomTabSelected" TargetType="FrameworkElement">
                <Setter Property="Visibility" Value="Collapsed" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SelectedItem.CategoryId, ElementName=PART_CarRestrictionCategoryList}">
                        <DataTrigger.Value>
                            <local:CarRestrictionsCategory>Custom</local:CarRestrictionsCategory>
                        </DataTrigger.Value>
                        <Setter Property="Visibility" Value="Visible" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            
            <Style x:Key="A_FrameworkElement_HideWhenCustomTabSelected" TargetType="FrameworkElement">
                <Setter Property="Visibility" Value="Visible" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SelectedItem.CategoryId, ElementName=PART_CarRestrictionCategoryList}">
                        <DataTrigger.Value>
                            <local:CarRestrictionsCategory>Custom</local:CarRestrictionsCategory>
                        </DataTrigger.Value>
                        <Setter Property="Visibility" Value="Collapsed" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

        </ResourceDictionary>
    </Page.Resources>

    <Grid>
        <Control Template="{StaticResource A_ControlTemplate_Blueprint_Background}"/>

        <!-- Bars -->
        <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}"
                            local:ControllerButtonPanel.ADescription="{local:Loc HelpButtons.IDS_Select}"
                            local:ControllerButtonPanel.BDescription="{local:Loc HelpButtons.IDS_Back}"
                            local:ControllerButtonPanel.XDescription="{local:Loc HelpButtons.IDS_ViewCars}"/>
        </ContentControl>
        <local:NetworkCountdownControl Style="{StaticResource A_Style_NetworkCountdownControl_EventSetup}" />

        <Grid x:Name="LayoutRoot">
            <Border Style="{StaticResource A_Style_Border_ScenePadding_Opus}">
                <DockPanel Margin="72,0,16,10" Height="848">
                    <DockPanel HorizontalAlignment="Left" Height="710" Margin="0,-14,0,0">
                        <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}"
                                   DockPanel.Dock="Top">
                            <ContentControl Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                            Content="{Binding Title}"
                                            local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Blueprint.png"
                                            HorizontalAlignment="Left" />
                        </Decorator>
                        <Grid Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_1}"
                              Width="{StaticResource A_Double_CarRestritions_TilePanelWidth}"
                              DockPanel.Dock="Top">
                            <local:FZButton HorizontalAlignment="Left"
                                    VerticalAlignment="Top"
                                    Style="{StaticResource A_Style_Button_TabTitleLB_CarSelect}"
                                    Command="{Binding ScrollPagePrevCommand, ElementName=PART_CarRestrictionCategoryList}"
                                    IsEnabled="{Binding CanSelectPrev, ElementName=PART_CarRestrictionCategoryList}"/>
                            <local:FZButton HorizontalAlignment="Right"
                                    VerticalAlignment="Top"
                                    Style="{StaticResource A_Style_Button_TabTitleRB_CarSelect}"
                                    Command="{Binding ScrollPageNextCommand, ElementName=PART_CarRestrictionCategoryList}"
                                    IsEnabled="{Binding CanSelectNext, ElementName=PART_CarRestrictionCategoryList}"/>
                            <local:ItemsSelector x:Name="PART_CarRestrictionCategoryList"
                                                 Style="{StaticResource A_Style_Carousel4ItemList_TabBar}"
                                                 Focusable="False"
                                                 ItemsSource="{Binding Categories}"/>
                        </Grid>
                        <Grid Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_3}"
                              DockPanel.Dock="Bottom"
                              HorizontalAlignment="Left">
                            <Grid Style="{StaticResource A_FrameworkElement_HideWhenCustomTabSelected}"
                                   Width="{StaticResource A_Double_CarRestritions_TilePanelWidth}"
                                   Height="{StaticResource A_Double_CampaignSetupDescriptionPanel_Height}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="2" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>

                                <StackPanel Orientation="Horizontal">
                                    <StackPanel Margin="0,16,0,0" Orientation="Horizontal">
                                        <local:FZMaterial Width="66" Height="66"
                                                          Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterLeftOnly}"
                                                          Color="{StaticResource A_Color_Tile_Background_Alternate}">
                                            <local:FZTextBlock Text="{Binding NumGarageCarsEligible}"
                                                       Style="{StaticResource A_Style_FZTextBlock_CarEligibilityValue}"
                                                       HorizontalAlignment="Center" FontSize="34"
                                                       Color="{StaticResource A_Color_White}" />
                                        </local:FZMaterial>
                                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_Right}"
                                                          Height="66" Width="420">
                                            <Decorator LayoutTransform="{StaticResource A_Transform_Italic}">
                                                <local:FZTextBlock Text="{local:Loc CarFlow.IDS_EligibleGarageCars}" 
                                                    Style="{StaticResource A_Style_FZTextBlock_CarEligibilityLabel}" />
                                            </Decorator>
                                        </local:FZMaterial>
                                    </StackPanel>

                                    <Control Template="{StaticResource A_Control_Eligible_Car_Panel}"/>
                                </StackPanel>
                            </Grid>
                            
                            <Decorator Style="{StaticResource A_FrameworkElement_ShowWhenCustomTabSelected}"
                                   Width="{StaticResource A_Double_CarRestritions_TilePanelWidth}"
                                   Height="{StaticResource A_Double_CampaignSetupDescriptionPanel_Height}">
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_Pill}">
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DescriptionBlockBody}"
                                                   DataContext="{Binding TileMenuNavigationManager.SelectedTile}"
                                                   Text="{local:Loc EventBlueprint.IDS_CustomCarRestrictions_Description}"
                                                   VerticalAlignment="Center"
                                                   Margin="24,12"
                                                   TextWrapping="Wrap"/>
                                </local:FZMaterial>
                            </Decorator>
                        </Grid>

                        <Grid Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_2}" 
                              Width="{StaticResource A_Double_CarRestritions_TilePanelWidth}" Margin="-2,-26,0,0"
                              Height="{StaticResource A_Double_CarRestritions_TilePanelHeightWithExternalPadding}">
                                <local:CommonListBox Style="{StaticResource A_Style_ListBox_CarRestriction_EmptyItems}"
                                                 Tag="{Binding SelectedItem.CategoryId, ElementName=PART_CarRestrictionCategoryList}">
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                                <Control/>
                            </local:CommonListBox>
                            <local:CommonListBox x:Name="PART_CarRestrictionItemList" 
                                                 Style="{StaticResource A_Style_ListBox_CarRestriction}" 
                                                 HorizontalAlignment="Left"
                                                 ItemsSource="{Binding SelectedItem.Items, ElementName=PART_CarRestrictionCategoryList}"
                                                 Tag="{Binding SelectedItem.CategoryId, ElementName=PART_CarRestrictionCategoryList}"
                                                 AllowMouseWheelScrolling="False"/>
                        </Grid>
                    </DockPanel>

                    <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}"
                               DockPanel.Dock="Right"
                               HorizontalAlignment="Right">
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FlyerBorder_Glass}"
                                          HorizontalAlignment="Right"
                                          VerticalAlignment="Top">
                            <Grid Margin="6">
                                <Decorator Style="{StaticResource A_FrameworkElement_HideWhenCustomTabSelected}">
                                    <ContentControl  x:Name="PART_Flyer"
                                                 Style="{StaticResource A_Style_ContentControl_CampaignFlyerFront}"
                                                 DataContext="{Binding CampaignSetup}" />
                                </Decorator>

                                <Decorator Style="{StaticResource A_FrameworkElement_ShowWhenCustomTabSelected}">
                                    <Control  x:Name="CustomFlyer"
                                              Height="{StaticResource A_Double_CampaignSetupFlyerHeight}"
                                              Width="{StaticResource A_Double_CampaignSetupFlyerWidth}"
                                              Template="{StaticResource A_ControlTemplate_BlueprintFlyer}"
                                              Tag="{local:Loc EventBlueprint.IDS_CustomCarRestrictions_FlyerText}"
                                              local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/CarRestrictions/Custom/HorizonBlueprint_CarThemes.png"/>
                                </Decorator>
                            </Grid>
                        </local:FZMaterial>
                    </Decorator>
                </DockPanel>
            </Border>
        </Grid>
    </Grid>
</Page>