<Page 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"
      x:Class="ForzaUI.A_RareCarDealershipLanging"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}"
      local:AttachedTileMenu.TileMenuNavigationManager="{local:TileMenuNavigationManager}">
    <Page.Resources>
        <Double x:Key="A_Double_HeadingText_CapHeight">67</Double>
        <Double x:Key="A_Double_HeadingText_CapHeight_KO">60</Double>
        <Double x:Key="A_Double_HeadingText_CapHeight_IT">60</Double>
        <Double x:Key="A_Double_HeadingText_CapHeight_RU">60</Double>

        <Double x:Key="A_Double_HeadingText_LineAdjust_PT">-0.5</Double>
        <Double x:Key="A_Double_HeadingText_LineAdjust_FI">-0.5</Double>
        <Double x:Key="A_Double_HeadingText_LineAdjust_TR">-0.5</Double>

        <Style x:Key="H_Style_ImageTile_HeadingText_Backstage"
               TargetType="{Type FZTextBlock}"
               BasedOn="{StaticResource H_Style_ImageTile_HeadingText}">
            <Setter Property="LineAdjust" Value="{local:LocalizedResource A_Double_HeadingText_LineAdjust}" />
            <Setter Property="CapHeight" Value="{local:LocalizedResource A_Double_HeadingText_CapHeight}" />
        </Style>

        <GridLength
        x:Key="H_Height_ImageTile_HeaderAndDescriptionTextSpacing">32</GridLength>

        <DataTemplate x:Key="Template_ShopTile">
            <Grid>
                <FZMaterial
                    Style="{StaticResource H_Style_ImageTile_Background}" />
                <Grid
                    Style="{StaticResource H_Style_ImageTile_ContentsPanel}">
                    <Grid.RowDefinitions>
                        <RowDefinition
                            Height="Auto" />
                        <RowDefinition
                            Height="{StaticResource H_Height_ImageTile_HeaderAndDescriptionTextSpacing}" />
                        <RowDefinition
                            Height="Auto" />
                    </Grid.RowDefinitions>
                    <FZTextBlock
                        Grid.Row="0"
                        Style="{StaticResource H_Style_ImageTile_HeadingText_Backstage}"/>
                    <FZTextBlock
                        Grid.Row="2"
                        Style="{StaticResource H_Style_ImageTile_DescriptionText}"/>
                </Grid>
                <FZTextBlock CapHeight="52" Text="{Binding BackstagePassCountString, RelativeSource={RelativeSource AncestorType=Page}}" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" Color="{StaticResource H_Color_Primary_White}" Margin="0,-130,0,0" />
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="Template_VoteTile">
            <Grid>
                <FZMaterial Style="{StaticResource H_Style_ImageTile_Background}" />
                <Grid Style="{StaticResource H_Style_ImageTile_ContentsPanel}">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="{StaticResource H_Height_ImageTile_HeaderAndDescriptionTextSpacing}" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <FZTextBlock Grid.Row="0"
                                 Style="{StaticResource H_Style_ImageTile_HeadingText_Backstage}"/>
                    <FZTextBlock Grid.Row="2"
                                 Style="{StaticResource H_Style_ImageTile_DescriptionText}"/>
                </Grid>
            </Grid>
        </DataTemplate>
    </Page.Resources>

  <local:UIPageTransitionManager.TransitionManager>
    <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_TiledSubMenu}"/>
  </local:UIPageTransitionManager.TransitionManager>

  <Grid x:Name="LayoutRoot">
    <Control Style="{StaticResource A_Style_Control_ScreenBackground}" />
    <!-- Bars -->
    <local:PlayerBarControl x:Name="TopBar" Style="{StaticResource A_Style_PlayerBarControl}" />
    <ContentControl Style="{StaticResource A_Style_ButtonBar}"
                    x:Name="BottomBar">
      <ControllerButtonPanel x:Name="PART_HelpPanel"
                           Style="{StaticResource A_Style_ControllerButtonPanel_Default}">
        <ControllerButtonControl Button="A"
                                       Description="{Loc HelpButtons.IDS_Select}" />
        <ControllerButtonControl Button="B"
                                       Description="{Loc HelpButtons.IDS_Back}" />
      </ControllerButtonPanel>
    </ContentControl>
    <Decorator
        Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}"
        Width="Auto"
        Height="Auto"
        HorizontalAlignment="Center"
        VerticalAlignment="Center">
      <Grid>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Decorator Style="{StaticResource A_Style_FrameworkElement_TiledMenuTransition_0}"
            HorizontalAlignment="Left"
            VerticalAlignment="Bottom"
            Grid.Row="0">
          <ContentControl Content="{Convert {local:Loc Lobby.IDS_RareCarDealershipShop_Title}, Converter={StringToUpper}}"
              Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"/>
        </Decorator>

        <Decorator x:Name="PART_MenuContent"
            RenderTransformOrigin="0.5,0.5"
            HorizontalAlignment="Center"
            VerticalAlignment="Top"
            Grid.Row="1">
          <Grid
              Style="{StaticResource H_Style_Grid_4TileMenu}"
              x:Name="PART_SCOPE_Home">
            <Grid.ColumnDefinitions>
              <ColumnDefinition />
              <ColumnDefinition />
              <ColumnDefinition />
              <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition />
              <RowDefinition />
              <RowDefinition />
              <RowDefinition />
              <RowDefinition />
              <RowDefinition />
              <RowDefinition />
              <RowDefinition />
            </Grid.RowDefinitions>
            <local:FZButton x:Name="PART_Button_Vote"
                    Style="{StaticResource H_Style_ImageTile}"
                    ContentTemplate="{StaticResource Template_VoteTile}"
                    Command="{Binding GoToVoteCommand, RelativeSource={RelativeSource AncestorType=Page}}"
                    IsEnabled="{Binding VoteActive, RelativeSource={RelativeSource AncestorType=Page}}"
                    TileMenuNavigationManager.InitialSelection="True">
              <local:FZButton.DataContext>
                <local:TileMenuDataItem Heading="{local:Loc Lobby.IDS_RareCarDealership_VoteTile_Title}"
                                        Description="{Binding VoteTimeRemainingString, RelativeSource={RelativeSource AncestorType=Page}}"
                                        Icon="Textures\Data_Bound\Rare_Car_Dealership\LandingScreen\Tile_Left_Background.png">
                </local:TileMenuDataItem>
              </local:FZButton.DataContext>
            </local:FZButton>            
            <local:FZButton x:Name="PART_Button_Shop"
                    Style="{StaticResource H_Style_ImageTile}"
                    ContentTemplate="{StaticResource Template_ShopTile}"
                    Command="{Binding GoToShopCommand, RelativeSource={RelativeSource AncestorType=Page}}"
                    Grid.Column="2">
              <local:FZButton.DataContext>
                <local:TileMenuDataItem Heading="{local:Loc Lobby.IDS_RareCarDealership_ShopTile_Title}"
                                        Description="{local:Loc Lobby.IDS_Backstage_Passes_Activation_Map_Description}"
                                        Icon="Textures\Data_Bound\Rare_Car_Dealership\LandingScreen\Tile_Right_Background.png" />
              </local:FZButton.DataContext>
            </local:FZButton>
          </Grid>
        </Decorator>
      </Grid>
    </Decorator>
  </Grid>
</Page>

