<PauseMenuTiled
    DataContext="{Binding RelativeSource={RelativeSource Self}}"
    FlowDirection="LeftToRight"
    Style="{StaticResource A_Style_Page_Generic}"
    mc:Ignorable="d"
    x:Class="ForzaUI.A_PauseMenuInitialDrive"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:ForzaUI;assembly="
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Name="Page"
    AttachedTileMenu.TileMenuNavigationManager="{TileMenuNavigationManager}">
    <Page.Resources>
        <ResourceDictionary>
            
            <MappingConverter x:Key="H_PauseMenuEventState_ToQuitEventHeading"
                Default="{Loc PauseMenu.IDS_TileTitle_QuitEvent}">
                <MappingConverterEntry Key="{Static PauseMenuEventState.Unranked}" Value="{Loc PauseMenu.IDS_TileTitle_AbandonAdventure_Unranked}"/>
                <MappingConverterEntry Key="{Static PauseMenuEventState.EliteSeries}" Value="{Loc PauseMenu.IDS_TileTitle_AbandonAdventure_EliteSeries}"/>
                <MappingConverterEntry Key="{Static PauseMenuEventState.SeasonalChampionship}" Value="{Loc PauseMenu.IDS_TileTitle_AbandonAdventure_SeasonalChampionship}"/>
                <MappingConverterEntry Key="{Static PauseMenuEventState.HorizonTour}" Value="{Loc PauseMenu.IDS_TileTitle_AbandonAdventure_HorizonTour}"/>
                <MappingConverterEntry Key="{Static PauseMenuEventState.SIDITestDrive}" Value="{Loc PauseMenu.IDS_TileTitle_QuitEvent_TestDrive}"/>    
                <MappingConverterEntry Key="{Static PauseMenuEventState.InitialDrive}" Value="{Loc PauseMenu.IDS_TileTitle_QuitEvent_InitialDrive}"/>    
            </MappingConverter>

            <MappingConverter x:Key="H_PauseMenuEventState_ToQuitEventDescription"
                Default="{Loc PauseMenu.IDS_TileText_QuitEvent}">
                <MappingConverterEntry Key="{Static PauseMenuEventState.Unranked}" Value="{Loc PauseMenu.IDS_TileText_AbandonAdventure_Unranked}"/>
                <MappingConverterEntry Key="{Static PauseMenuEventState.EliteSeries}" Value="{Loc PauseMenu.IDS_TileText_AbandonAdventure_EliteSeries}"/>
                <MappingConverterEntry Key="{Static PauseMenuEventState.SeasonalChampionship}" Value="{Loc PauseMenu.IDS_TileText_AbandonAdventure_SeasonalChampionship}"/>
                <MappingConverterEntry Key="{Static PauseMenuEventState.HorizonTour}" Value="{Loc PauseMenu.IDS_TileText_AbandonAdventure_HorizonTour}"/>
                <MappingConverterEntry Key="{Static PauseMenuEventState.EventLabTestDrive}" Value="{Loc PauseMenu.IDS_TileText_QuitEvent_EventlabTestDrive}"/>
                <MappingConverterEntry Key="{Static PauseMenuEventState.TestTrack}" Value="{Loc PauseMenu.IDS_TileText_QuitEvent_TestTrack}"/>
                <MappingConverterEntry Key="{Static PauseMenuEventState.SIDITestDrive}" Value="{Loc PauseMenu.IDS_TileText_QuitEvent_TestDrive}"/>
            </MappingConverter>

            <Style x:Key="A_Style_Button_PauseMenuInitialDrive"
                   BasedOn="{StaticResource A_Style_FZButton_Tiled_TextMenu}"
                   TargetType="FZButton">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding (local:TileMenuNavigationManager.TileState), RelativeSource={RelativeSource FindAncestor, AncestorType=Button}}"
                                 Value="{x:Static local:TileState.EnabledNonInteractive}">
                        <Setter Property="Tag"
                                Value="Inactive" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_Control_Loading_ControllerMappingIE_Pause"
                   TargetType="Control">
                <Style.Setters>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
                                    <Control Style="{StaticResource A_Style_Control_ControllerMapping}"
                                             Visibility="{Binding IsWheel, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}"
                                             VerticalAlignment="Center"
                                             HorizontalAlignment="Center" />
                                    <Control Style="{StaticResource A_Style_Control_WheelMapping}"
                                             Visibility="{Binding IsWheel, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                                             VerticalAlignment="Center"
                                             HorizontalAlignment="Center" />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style.Setters>
            </Style>

        </ResourceDictionary>
    </Page.Resources>
    <UIPageTransitionManager.TransitionManager>
        <UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_TiledSubMenu}" />
    </UIPageTransitionManager.TransitionManager>
    <Grid KeyboardNavigation.DirectionalNavigation="Contained"
          x:Name="PART_LayoutRoot"
          ScreenReader.Line="{Loc ScreenTitles.IDS_PauseMenu}"
          ScreenReader.Event="OnLoad"
          ScreenReader.LineType="ScreenTitle">
          <MappingConverterResourcePreloader Converter="{StaticResource A_Converter_BooleanToToggleIconImageSource}" ValueType="BitmapImage" />
        <!--Main Tile Content -->
        <Control Style="{StaticResource A_Style_Control_ScreenBackground}" />

        <!-- Bars -->
        <PlayerBarControl Style="{StaticResource A_Style_PlayerBarControl}"
                          x:Name="TopBar" />

        <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 Visibility="Collapsed">
            <Grid>
                <!--These buttons need to be here for PauseMenuTiled.cpp #pgEOzdemir-->
                <Grid Grid.Row="0">
                        <FZButton x:Name="PART_GROUP_Campaign" />
                        <FZButton x:Name="PART_GROUP_Cars" />
                        <FZButton x:Name="PART_GROUP_MyHorizon" />
                        <FZButton x:Name="PART_GROUP_Online" />
                        <FZButton x:Name="PART_GROUP_CreativeHub" />
                        <FZButton x:Name="PART_GROUP_Store" />
                </Grid>

                <Grid Grid.Row="1">
                    <Grid x:Name="PART_SCOPE_Campaign">
                        <FZButton x:Name="PART_Button_Campaign_FestivalPass" />
                        <FZButton x:Name="PART_Button_Campaign_SaveAndSync" />
                        <FZButton x:Name="PART_Button_Campaign_ExitToDesktop" />
                        <FZButton x:Name="PART_Button_Campaign_CampaignProgress" />
                        <FZButton x:Name="PART_Button_Campaign_GoldenPath" />
                        <FZButton x:Name="PART_Button_Campaign_Settings" />
                        <FZButton x:Name="PART_Button_Campaign_Map" />
                        <FZButton x:Name="PART_Button_Campaign_QuitEvent" />
                        <FZButton x:Name="PART_Button_Campaign_RestartEvent" />
                    </Grid>

                    <Grid x:Name="PART_SCOPE_MyHorizon">
                        <MessagesLiveTile x:Name="PART_Button_MyHorizon_MessageCenter" />
                        <FZButton x:Name="PART_Button_MyHorizon_Badges" />
                        <FZButton x:Name="PART_Button_MyHorizon_Stats" />
                        <FZButton x:Name="PART_Button_MyHorizon_Tombola" />
                        <FZButton x:Name="PART_Button_MyHorizon_SuperTombola" />
                        <FZButton x:Name="PART_Button_MyHorizon_EstateMenu" />
                        <FZButton x:Name="PART_Button_MyHorizon_BarnFindBlueprint" />
                        <FZButton x:Name="PART_Button_MyHorizon_DroneMode" />
                        <FZButton x:Name="PART_Button_MyHorizon_CustomiseCharacter" />
                    </Grid>

                    <Grid x:Name="PART_SCOPE_Online">
                        <FZButton x:Name="PART_Button_Online_HorizonOpen" />
                        <FZButton x:Name="PART_Button_Online_Rivals" />
                        <FZButton x:Name="PART_Button_Online_HorizonOnline" />
                        <FZButton x:Name="PART_Button_Online_HorizonSolo" />
                        <FZButton x:Name="PART_Button_Online_PlayerList" />
                        <FZButton x:Name="PART_Button_JoinFriend" />
                        <FZButton x:Name="PART_Button_Online_Convoy" />
                        <FZButton x:Name="PART_Button_Online_QuickChat" />
                    </Grid>

                    <Grid x:Name="PART_SCOPE_CreativeHub">
                        <FZButton x:Name="PART_Button_CreativeHub_MyShowroom" />
                        <FZButton x:Name="PART_Button_CreativeHub_Photos" />
                        <FZButton x:Name="PART_Button_CreativeHub_Blueprints" />
                        <FZButton x:Name="PART_Button_CreativeHub_Tunings" />
                        <FZButton x:Name="PART_Button_CreativeHub_VinylGroups" />
                        <FZButton x:Name="PART_Button_CreativeHub_PhotoMode" />
                        <FZButton x:Name="PART_Button_CreativeHub_Paints" />
                        <FZButton x:Name="PART_Button_Browse_Estates" />
                        <FZButton x:Name="PART_Button_Browse_Garage_Layouts" />
                    </Grid>

                    <Grid x:Name="PART_SCOPE_Cars">
                        <FZButton x:Name="PART_Button_Cars_CarMastery" />
                        <FZButton x:Name="PART_Button_Cars_GoToAutoshow" />
                        <FZButton x:Name="PART_Button_Cars_TreasureCars" />
                        <FZButton x:Name="PART_Button_Cars_BarnFinds" />
                        <FZButton x:Name="PART_Button_Cars_TuneCar" />
                        <FZButton x:Name="PART_Button_Cars_MyCars" />
                        <FZButton x:Name="PART_Button_Cars_Horn" />
                    </Grid>

                    <Grid x:Name="PART_SCOPE_Store">
                        <FZButton x:Name="PART_Button_Store_CarPacks" />
                        <MarketplaceFeaturedLiveTile x:Name="PART_Button_Store_Upsell" />
                        <FZButton x:Name="PART_Button_Store_TreasureMap" />
                        <FZButton x:Name="PART_Button_Store_SeasonPass" />
                    </Grid>
                </Grid>
            </Grid>
        </Decorator>

        <Grid x:Name="A_ControllerLoadingForeground"
              Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <local:FZMaterialGlassCapture />
            
            <Decorator x:Name="PART_MenuContent">
                <Grid Style="{StaticResource A_Style_Grid_Tiled_TextMenu}"
                      VerticalAlignment="Bottom"
                      HorizontalAlignment="Left">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <local:FZButton x:Name="PART_IE_Settings_Button"
                                    Style="{StaticResource A_Style_Button_PauseMenuInitialDrive}"
                                    TileMenuNavigationManager.InitialSelection="True"
                                    Grid.Row="0"
                                    Command="{Binding SettingsCommand, RelativeSource={RelativeSource AncestorType=Page}}">
                        <local:FZButton.DataContext>
                            <local:TileMenuDataItem Heading="{Loc PauseMenu.IDS_TileTitle_Settings}"
                                                    Description="{Loc PauseMenu.IDS_TileText_Settings}" />
                        </local:FZButton.DataContext>
                    </local:FZButton>

                    <local:FZButton Grid.Row="1"
                                    Command="{Binding RestartEventCommand, RelativeSource={RelativeSource AncestorType=Page}}">
                        <FZButton.Style>
                            <Style TargetType="{Type FZButton}"
                                   BasedOn="{StaticResource A_Style_Button_PauseMenuInitialDrive}">
                                <Setter Property="TileMenuNavigationManager.TileState"
                                        Value="{Static TileState.Disabled}" />
                                <Setter Property="Tag"
                                        Value="Inactive" />
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding CanRestartEvent, RelativeSource={RelativeSource AncestorType=Page}, FallbackValue=False}"
                                                 Value="True">
                                        <Setter Property="TileMenuNavigationManager.TileState"
                                                Value="{Static TileState.Enabled}" />
                                        <Setter Property="Tag"
                                                Value="Active" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </FZButton.Style>
                        <FZButton.DataContext>
                            <TileMenuDataItem Heading="{Loc PauseMenu.IDS_TileTitle_RestartEvent}"
                                              Description="{Loc PauseMenu.IDS_TileText_RestartEvent}" />
                        </FZButton.DataContext>
                    </local:FZButton>
                    <local:FZButton Grid.Row="2"
                                    Command="{Binding QuitEventCommand, RelativeSource={RelativeSource AncestorType=Page}}">
                        <FZButton.Style>
                            <Style TargetType="{Type FZButton}"
                                   BasedOn="{StaticResource A_Style_Button_PauseMenuInitialDrive}">
                                <Setter Property="TileMenuNavigationManager.TileState"
                                        Value="{Static TileState.Disabled}" />
                                <Setter Property="Tag"
                                        Value="Inactive" />
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding CanQuitEvent, RelativeSource={RelativeSource AncestorType=Page}, FallbackValue=False}"
                                                 Value="True">
                                        <Setter Property="TileMenuNavigationManager.TileState"
                                                Value="{Static TileState.Enabled}" />
                                        <Setter Property="Tag"
                                                Value="Active" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </FZButton.Style>
                        <FZButton.DataContext>
                            <TileMenuDataItem Heading="{Binding CurrentEventState, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource H_PauseMenuEventState_ToQuitEventHeading}}"
                                              Description="{Binding CurrentEventState, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource H_PauseMenuEventState_ToQuitEventDescription}}" />
                        </FZButton.DataContext>
                    </local:FZButton>

                    <local:FZButton Grid.Row="3"
                                    Style="{StaticResource A_Style_Button_PauseMenuInitialDrive}"
                                    TileMenuNavigationManager.TileState="{Binding IsPC, Source={StaticResource PART_UISceneContext}, Converter={StaticResource A_Converter_BooleanToTileState}}"
                                    Command="{Binding ExitToDesktopCommand, RelativeSource={RelativeSource AncestorType=Page}}">
                        <local:FZButton.DataContext>
                            <TileMenuDataItem Heading="{Loc PauseMenu.IDS_TileTitle_ExitToDesktop}" />
                        </local:FZButton.DataContext>
                    </local:FZButton>
                </Grid>
            </Decorator>

        </Grid>

        <Decorator Style="{StaticResource A_Style_FrameworkElement_FadeOnlyTransition_0}">
            <Control Style="{StaticResource A_Style_Control_Loading_ControllerMappingIE_Pause}">
                <Control.LayoutTransform>
                    <TransformGroup>
                        <ScaleTransform ScaleX="1.34"
                                        ScaleY="1.34" />
                    </TransformGroup>
                </Control.LayoutTransform>
            </Control>
        </Decorator>

    </Grid>
</PauseMenuTiled>
