<Page x:Class="ForzaUI.Scenes.Anthem.A_RivalsDestinationSelect"
      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"
      mc:Ignorable="d"
      xmlns:local="clr-namespace:ForzaUI;assembly="
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">

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

    <Page.Resources>

        <System:Double x:Key="A_Double_Size_RivalsTileUnitSizeWithGap">385</System:Double>

        <local:LinearTransformConverter x:Key="A_LinearTransformConverter_RivalsTilePositionTransform" 
                                        Scale="{StaticResource A_Double_Size_RivalsTileUnitSizeWithGap}"/>

        <local:MappingConverter x:Key="A_Converter_AvailableRouteCountToTileState"
            Default="{x:Static local:TileState.Enabled}">
            <local:MappingConverterEntry Key="0" Value="{x:Static local:TileState.Disabled}"/>
        </local:MappingConverter>

        <Style x:Key="A_Style_Button_Tile_RivalsDiscipline"
               TargetType="{x:Type local:FZButton}"
               BasedOn="{StaticResource A_Style_Button_OpusTile}">
            <Setter Property="Width" Value="380"/>
            <Setter Property="Height" Value="667"/>
            <Setter Property="Canvas.Left"
                    Value="{Binding Path=(local:TileMenuNavigationManager.GridX) ,RelativeSource={RelativeSource Self}, Converter={StaticResource A_LinearTransformConverter_RivalsTilePositionTransform}}" />
            <Setter Property="Canvas.Top"
                    Value="{Binding Path=(local:TileMenuNavigationManager.GridY) ,RelativeSource={RelativeSource Self}, Converter={StaticResource A_LinearTransformConverter_RivalsTilePositionTransform}}" />
            <Setter Property="local:TileMenuNavigationManager.GridWidth" Value="1"/>
            <Setter Property="local:TileMenuNavigationManager.GridHeight" Value="1"/>
            <Setter Property="local:TileMenuNavigationManager.TileState" Value="{Binding AvailableRouteCount, Converter={StaticResource A_Converter_AvailableRouteCountToTileState}}"/>
        </Style>
    </Page.Resources>


    <Grid>
        <!-- Background Blur -->
       <Control Style="{StaticResource A_Style_Control_ScreenBackground}" />

        <local:PlayerBarControl x:Name="TopBar" Style="{StaticResource A_Style_PlayerBarControl}" />
        <ContentControl Style="{StaticResource A_Style_ButtonBar}"
                        Width="Auto">
            <ContentControl x:Name="DefaultHelpPanel"
                            local:ControllerButtonPanel.ADescription="{local:Loc HelpButtons.IDS_Select}"
                            local:ControllerButtonPanel.BDescription="{local:Loc HelpButtons.IDS_Back}"
                            Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}" />
        </ContentControl>

        <Border Style="{StaticResource A_Style_Border_ScenePadding}">
            <Grid x:Name="LayoutRoot" KeyboardNavigation.DirectionalNavigation="Contained">
                <Grid Style="{StaticResource A_Style_FrameworkElement_ScreenTilt}" Margin="0,0,0,0">
                    <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center">
                        <StackPanel Orientation="Horizontal" Margin="0,0" Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                            <ContentControl Content="{local:Loc ScreenTitles.IDS_Rivals_DisciplineSelect_Title}" Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                            local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Rivals.png"/>
                        </StackPanel>

                        <StackPanel x:Name="PART_MenuContent" RenderTransformOrigin="0.5,0.5" Margin="0,0,0,0">
                            <local:AutoSizeCanvas x:Name="PART_SCOPE_Home">
                                <local:FZButton x:Name="PART_Button_Asphalt"
                                        local:TileMenuNavigationManager.GridX="0"
                                        local:TileMenuNavigationManager.GridY="0"
                                        Style="{StaticResource A_Style_Button_Tile_RivalsDiscipline}"
                                        Template="{StaticResource A_ControlTemplate_RivalsDestinationTile}"
                                        Tag="{StaticResource A_Color_Tile_Title}"
                                        local:UIPageTransitionManager.TransitionIndex="0"
                                        DataContext="{Binding RivalsItem_Asphalt}"/>
                                <local:FZButton x:Name="PART_Button_Dirt"
                                        local:TileMenuNavigationManager.GridX="1"
                                        local:TileMenuNavigationManager.GridY="0"
                                        Style="{StaticResource A_Style_Button_Tile_RivalsDiscipline}"
                                        Template="{StaticResource A_ControlTemplate_RivalsDestinationTile}"
                                        Tag="{StaticResource A_Color_Tile_Title_Alternate}"
                                        local:UIPageTransitionManager.TransitionIndex="1"
                                        DataContext="{Binding RivalsItem_Dirt}"/>
                                <local:FZButton x:Name="PART_Button_CrossCountry"
                                        local:TileMenuNavigationManager.GridX="2"
                                        local:TileMenuNavigationManager.GridY="0"
                                        Style="{StaticResource A_Style_Button_Tile_RivalsDiscipline}"
                                        Template="{StaticResource A_ControlTemplate_RivalsDestinationTile}"
                                        Tag="{StaticResource A_Color_Tile_Title_Alternate}"
                                        local:UIPageTransitionManager.TransitionIndex="2"
                                        DataContext="{Binding RivalsItem_CrossCountry}"/>
                                <local:FZButton x:Name="PART_Button_Drag"
                                        local:TileMenuNavigationManager.GridX="3"
                                        local:TileMenuNavigationManager.GridY="0"
                                        Style="{StaticResource A_Style_Button_Tile_RivalsDiscipline}"
                                        Template="{StaticResource A_ControlTemplate_RivalsDestinationTile}"
                                        Tag="{StaticResource A_Color_Tile_Title_Alternate}"
                                        local:UIPageTransitionManager.TransitionIndex="3"
                                        DataContext="{Binding RivalsItem_Drag}"/>
                            </local:AutoSizeCanvas>
                        </StackPanel>
                    </StackPanel>
                </Grid>
            </Grid>
        </Border>

    </Grid>
</Page>
