<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_PreRaceMenuTiled"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">

    <Page.Resources>
        <ResourceDictionary>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_StartingGrid"
                Heading="{local:Loc PreRaceMenu.IDS_TileTitle_StartingGrid}"
                Description="{local:Loc PreRaceMenu.IDS_TileText_StartingGrid}"
                Icon="/ForzaUI;component/Textures/Anthem/TileBackgrounds/StartingGrid.png"
                FloatingIcon="/ForzaUI;component/Textures/Anthem/Icons/TiledMenus/FloatingIcons/Starting_Grid.png" />
            <local:TileMenuDataItem x:Key="A_MenuDataItem_Assists"
                Heading="{local:Loc TiledMenus.IDS_Options_TileTitle_Difficulty}"
                Description="{local:Loc TiledMenus.IDS_Options_TileText_Difficulty}"
                Icon="/ForzaUI;component/Textures/Anthem/TileBackgrounds/DifficultyPreRace.png"
                FloatingIcon="/ForzaUI;component/Textures/Anthem/Icons/TiledMenus/FloatingIcons/Difficulty_Icon.png" />
            <local:TileMenuDataItem x:Key="A_MenuDataItem_Tuning"
                Heading="{local:Loc PreRaceMenu.IDS_TileTitle_Tuning}"
                Description="{local:Loc PreRaceMenu.IDS_TileText_Tuning}"
                Icon="/ForzaUI;component/Textures/Anthem/TileBackgrounds/TuneCar.png"
                FloatingIcon="/ForzaUI;component/Textures/Anthem/Icons/TiledMenus/FloatingIcons/TuningIcon.png" />
            <local:TileMenuDataItem x:Key="A_MenuDataItem_GameOptions"
                Description="{local:Loc PreRaceMenu.IDS_TileText_Options}"
                Icon="/ForzaUI;component/Textures/Anthem/Icons/TiledMenus/Options.png"/>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_Quit"
                Description="{local:Loc PreRaceMenu.IDS_TileText_QuitRace}"
                Icon="/ForzaUI;component/Textures/Anthem/Icons/TiledMenus/Quit.png" />
            <local:TileMenuDataItem x:Key="A_MenuDataItem_Standings"
                Description="{local:Loc PreRaceMenu.IDS_TileText_ChampionshipStandings}"
                Icon="/ForzaUI;component/Textures/Anthem/Icons/TiledMenus/ChampionshipStandings.png" />
        </ResourceDictionary>
    </Page.Resources>

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

    <Grid>
        <!-- Bars -->
        <local:PlayerBarControl x:Name="TopBar" Style="{StaticResource A_Style_PlayerBarControl}" />
        <ContentControl x:Name="BottomBar" Style="{StaticResource A_Style_ButtonBar}">
            <ContentControl x:Name="DefaultHelpPanel" local:ControllerButtonPanel.ADescription="{local:Loc HelpButtons.IDS_Select}" Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}" />
        </ContentControl>

        <Border Style="{StaticResource A_Style_Border_ScenePadding_TiledScene}">
            <Grid x:Name="LayoutRoot"
                KeyboardNavigation.DirectionalNavigation="Contained"
                Style="{StaticResource A_Style_FrameworkElement_ScreenTilt}"
                Margin="0,0,0,-25">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="{StaticResource A_GridLength_TileMenu_Height}"/>
                </Grid.RowDefinitions>

                <Decorator Style="{StaticResource A_Style_FrameworkElement_TiledMenuTransition_1}"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Bottom"
                    Margin="312,0,0,0"
                    Grid.Row="0">
                    <ContentControl Content="{Binding Title, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_StringToUpper}}"
                        Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                        local:BindingProxy.A="{Binding TitleIcon}" />
                </Decorator>

                <StackPanel x:Name="PART_MenuContent"
                    RenderTransformOrigin="0.5,0.5"
                    Grid.Row="1">
                    <local:AutoSizeCanvas x:Name="PART_SCOPE_Home">
                        <local:FZButton x:Name="PART_Button_Tuning"
                                DataContext="{StaticResource A_MenuDataItem_Tuning}"
                                Style="{StaticResource A_Style_Button_ImageTile}"
                                local:TileMenuNavigationManager.GridX="9"
                                local:TileMenuNavigationManager.GridY="0"
                                local:TileMenuNavigationManager.GridWidth="13"
                                local:TileMenuNavigationManager.GridHeight="16"/>
                        <local:FZButton x:Name="PART_Button_Options"
                                DataContext="{StaticResource A_MenuDataItem_GameOptions}"
                                Style="{StaticResource A_Style_Button_IconTile}"
                                local:TileMenuNavigationManager.GridX="13"
                                local:TileMenuNavigationManager.GridY="16"/>
                        <local:FZButton x:Name="PART_Button_Championship_Standings"
                                local:TileMenuNavigationManager.TileState="{x:Static local:TileState.Disabled}"
                                DataContext="{StaticResource A_MenuDataItem_Standings}"
                                Style="{StaticResource A_Style_Button_IconTile}"
                                local:TileMenuNavigationManager.GridX="13"
                                local:TileMenuNavigationManager.GridY="20"/>
                        <local:FZButton x:Name="PART_Button_QuitRace"
                                DataContext="{StaticResource A_MenuDataItem_Quit}"
                                Style="{StaticResource A_Style_Button_IconTile}"
                                local:TileMenuNavigationManager.GridX="52"
                                local:TileMenuNavigationManager.GridY="16"/>
                        <local:FZButton x:Name="PART_Button_StartRace"
                                DataContext="{Binding StartRaceDataItem}"
                                Style="{StaticResource A_Style_Button_MainImageTile}"
                                local:TileMenuNavigationManager.GridX="22"
                                local:TileMenuNavigationManager.GridY="0">
                        </local:FZButton>
                        <local:FZButton x:Name="PART_Button_Difficulty"
                                DataContext="{StaticResource A_MenuDataItem_Assists}"
                                Style="{StaticResource A_Style_Button_ImageTile}"
                                local:TileMenuNavigationManager.GridX="22"
                                local:TileMenuNavigationManager.GridY="16"
                                local:TileMenuNavigationManager.GridWidth="21"
                                local:TileMenuNavigationManager.GridHeight="14"/>
                        <local:DifficultyBonusInfographicTile x:Name="PART_Button_Infographic"
                                               Style="{StaticResource A_Style_Infographics_Button_Difficulty}"
                                               local:TileMenuNavigationManager.GridX="43"
                                               local:TileMenuNavigationManager.GridY="16">
                            <local:DifficultyBonusInfographicTile.DataContext>
                                <local:RadialInfographicData Title="{local:Loc TiledMenus.IDS_Infographics_DifficultyBonus}"
                                    Color="#00B18F"
                                    ProgressStringFormat="{x:Static local:InfographicStringFormat.PercentageAbsolute}"
                                    ForcePositiveSign="True"
                                    StatIcon="/ForzaUI;component/Textures/Data_Bound/Infographics/Difficulty_Bonus.png">
                                    <local:RadialInfographicData.LocalUserInfographicData>
                                        <local:UserInfographicData />
                                    </local:RadialInfographicData.LocalUserInfographicData>
                                </local:RadialInfographicData>
                            </local:DifficultyBonusInfographicTile.DataContext>
                        </local:DifficultyBonusInfographicTile>
                        <local:FZButton x:Name="PART_Button_StartingGrid"
                                DataContext="{StaticResource A_MenuDataItem_StartingGrid}"
                                Style="{StaticResource A_Style_Button_ImageTile}"
                                local:TileMenuNavigationManager.GridX="52"
                                local:TileMenuNavigationManager.GridY="0"
                                local:TileMenuNavigationManager.GridWidth="13"
                                local:TileMenuNavigationManager.GridHeight="16"/>
                    </local:AutoSizeCanvas>
                </StackPanel>
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="PART_STATEGROUP_Home">
                        <VisualState x:Name="PART_STATE_Home_Default"/>
                        <VisualState x:Name="PART_STATE_Home_Rivals"/>
                        <VisualState x:Name="PART_STATE_Home_Championship">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Button_Championship_Standings"
                                    Storyboard.TargetProperty="(local:TileMenuNavigationManager.TileState)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0.0" Value="{x:Static local:TileState.Enabled}"/>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="PART_STATE_Home_NoQuit">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Button_QuitRace"
                                    Storyboard.TargetProperty="(local:TileMenuNavigationManager.TileState)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0.0" Value="{x:Static local:TileState.Disabled}"/>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
            </Grid>
        </Border>
    </Grid>
</Page>
