<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_BucketListBlueprintTypeSelect"
      mc:Ignorable="d"
      DataContext="{Binding RelativeSource={RelativeSource Self}}"
      Style="{StaticResource A_Style_Page_Generic}"
      local:AttachedTileMenu.TileMenuNavigationManager="{local:TileMenuNavigationManager Width=8, Height=4}">

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

    <Page.Resources>
        <ResourceDictionary>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_SpeedCamera"
                                      Heading="{local:Loc BucketListBlueprint.IDS_TileTitle_SpeedCamera}"
                                      Description="{local:Loc BucketListBlueprint.IDS_TileDesc_SpeedCamera}"/>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_SkillScore"
                                      Heading="{local:Loc BucketListBlueprint.IDS_TileTitle_SkillScore}"
                                      Description="{local:Loc BucketListBlueprint.IDS_TileDesc_SkillScore}"/>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_Waypoint"
                                      Heading="{local:Loc BucketListBlueprint.IDS_TileTitle_Waypoint}"
                                      Description="{local:Loc BucketListBlueprint.IDS_TileDesc_Waypoint}"/>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_DangerSign"
                                      Heading="{local:Loc BucketListBlueprint.IDS_TileTitle_DangerSign}"
                                      Description="{local:Loc BucketListBlueprint.IDS_TileDesc_DangerSign}"/>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_SkillDrive"
                                      Heading="{local:Loc BucketListBlueprint.IDS_TileTitle_SkillDrive}"
                                      Description="{local:Loc BucketListBlueprint.IDS_TileDesc_SkillDrive}"/>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_SkillMastery"
                                      Heading="{local:Loc BucketListBlueprint.IDS_TileTitle_SkillMastery}"
                                      Description="{local:Loc BucketListBlueprint.IDS_TileDesc_SkillMastery}"/>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_DriftZone"
                                      Heading="{local:Loc BucketListBlueprint.IDS_TileTitle_DriftZone}"
                                      Description="{local:Loc BucketListBlueprint.IDS_TileDesc_DriftZone}"/>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_DamageControl"
                                      Heading="{local:Loc BucketListBlueprint.IDS_TileTitle_DamageControl}"
                                      Description="{local:Loc BucketListBlueprint.IDS_TileDesc_DamageControl}"/>

            <Style x:Key="A_Style_FZMaterial_LockableBucketListBlueprintTile" TargetType="local:FZMaterial" BasedOn="{StaticResource A_Style_FZMaterial_FlatPanel_Tile}">
                <Setter Property="Preset" Value="{StaticResource H_Roundtangle_8px}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding (local:TileMenuNavigationManager.LockState), RelativeSource={RelativeSource FindAncestor, AncestorType=Button}}" Value="{x:Static local:LockState.Locked}">
                        <Setter Property="Color" Value="{StaticResource A_Color_GlassPanel_NonInteractive}"/>
                        <Setter Property="Preset" Value="{StaticResource H_GlassRoundtangle_8px}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            
            <Style x:Key="A_Style_FZTextBlock_BucketListBlueprintTileTitle" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_TileTitle}">
                <Setter Property="Color" Value="{StaticResource A_Color_TextMenu_Text_Default}"/>
                <Setter Property="FontFamily" Value="Horizon_C"/>
                <Setter Property="FontSize" Value="55"/>
                <Setter Property="CapHeight" Value="35"/>
                <Setter Property="LineAdjust" Value="-0.75"/>
                <Setter Property="Text" Value="{Binding DataContext.Heading, RelativeSource={RelativeSource AncestorType=Button}}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding (local:TileMenuNavigationManager.LockState), RelativeSource={RelativeSource FindAncestor, AncestorType=Button}}" Value="{x:Static local:LockState.Locked}">
                        <Setter Property="Color" Value="{StaticResource H_Color_Primary_White}"/>
                        <Setter Property="Opacity" Value="0.6"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <ControlTemplate x:Key="A_ControlTemplate_FZButton_BucketListType_Tile" TargetType="local:FZButton">
                <Grid Style="{StaticResource A_Style_FrameworkElement_TiledMenuTransition}">
                    <local:FZMaterial x:Name="DropShadow" Style="{StaticResource A_Style_FZMaterial_TileShadow}"/>
                    <local:FZMaterial x:Name="BackingTile" Style="{StaticResource  A_Style_FZMaterial_LockableBucketListBlueprintTile}"/>
                    <Decorator VerticalAlignment="Top" HorizontalAlignment="Left" Margin="12,12,12,24">
                        <local:FZTextBlock x:Name="TitleText"
                                           Style="{StaticResource A_Style_FZTextBlock_BucketListBlueprintTileTitle}"
                                           TextAlignment="Left" 
                                           HorizontalAlignment="Center"
                                           Margin="0,10"/>
                    </Decorator>
                    <ContentPresenter/>
                    <StrokeHighlightControl Style="{StaticResource A_Style_ContentControl_TileSelectionStroke}"
                        ContentRadius="8"
                        InnerThickness="{StaticResource A_Thickness_StrokeHighlight_TileInner}"
                        OuterThickness="{StaticResource A_Thickness_StrokeHighlight_TileOuter}"/>
                </Grid>
            </ControlTemplate>

            <DataTemplate x:Key="A_ControlTemplate_BucketListType_TileContent">
                <Grid>
                    <local:FZMaterial x:Name="PadLock"
                                      Margin="0,0,20,20"
                                      VerticalAlignment="Bottom"
                                      HorizontalAlignment="Right" 
                                      Visibility="Hidden"
                                      Color="{StaticResource A_Color_Tile_Background_Locked}"
                                      Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerAll}">
                        <local:FZMaterial Width="62"
                                          Height="62"
                                          HorizontalAlignment="Center"
                                          VerticalAlignment="Center"
                                          ImageSource="/ForzaUI;component/Textures/Anthem/Icons/Pad_Lock.png"/>
                    </local:FZMaterial>
                </Grid>
                <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding (local:TileMenuNavigationManager.LockState), RelativeSource={RelativeSource FindAncestor, AncestorType=Button}}" Value="{x:Static local:LockState.Locked}">
                        <Setter TargetName="PadLock" Property="Visibility" Value="Visible"/>
                    </DataTrigger>
                </DataTemplate.Triggers>
            </DataTemplate>

            <System:Double x:Key="A_Double_Size_BucketList_TileUnitSizeWithGap">144</System:Double>
            <local:LinearTransformConverter x:Key="A_LinearTransformConverter_BucketListType_TilePositionTransform" Scale="{StaticResource A_Double_Size_BucketList_TileUnitSizeWithGap}"/>

            <System:Double x:Key="A_Double_Size_BucketList_TileSize">284</System:Double>
            <Style x:Key="A_Style_FZButton_BucketListTypeTile" TargetType="local:FZButton" BasedOn="{StaticResource A_Style_Button_RootTile}">
                <Setter Property="Width" Value="{StaticResource A_Double_Size_BucketList_TileSize}"/>
                <Setter Property="Height" Value="{StaticResource A_Double_Size_BucketList_TileSize}"/>

                <Setter Property="Canvas.Left"
                        Value="{Binding Path=(local:TileMenuNavigationManager.GridX) ,RelativeSource={RelativeSource Self}, Converter={StaticResource A_LinearTransformConverter_BucketListType_TilePositionTransform}}" />
                <Setter Property="Canvas.Top"
                        Value="{Binding Path=(local:TileMenuNavigationManager.GridY) ,RelativeSource={RelativeSource Self}, Converter={StaticResource A_LinearTransformConverter_BucketListType_TilePositionTransform}}" />
                <Setter Property="local:UIPageTransitionManager.TransitionIndex"
                        Value="0" />
                <Setter Property="local:TileMenuNavigationManager.GridWidth" Value="2"/>
                <Setter Property="local:TileMenuNavigationManager.GridHeight" Value="2"/>
                <Setter Property="Template" Value="{StaticResource A_ControlTemplate_FZButton_BucketListType_Tile}"/>
                <Setter Property="ContentTemplate" Value="{StaticResource A_ControlTemplate_BucketListType_TileContent}"/>
            </Style>
        </ResourceDictionary>
    </Page.Resources>

    <Grid>
        <Control Style="{StaticResource A_Style_Control_ScreenBackground}" />

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

        <Grid x:Name="PART_LayoutRoot">
            <Border Style="{StaticResource A_Style_Border_ScenePadding_Opus}">
                <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" >
                    <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}"
                               HorizontalAlignment="Left">
                        <ContentControl Content="{local:Loc ScreenTitles.IDS_CommunityChallengesType}"
                                        local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Blueprint.png"
                                        Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}" />
                    </Decorator>
                    <StackPanel Orientation="Horizontal">
                        <Decorator x:Name="PART_MenuContent" Panel.ZIndex="10" VerticalAlignment="Top">
                            <local:AutoSizeCanvas x:Name="PART_SCOPE_Home">
                                <local:FZButton x:Name="PART_Button_SpeedCamera"
                                        DataContext="{StaticResource A_MenuDataItem_SpeedCamera}"
                                        local:TileMenuNavigationManager.GridX="0"
                                        local:TileMenuNavigationManager.GridY="0"
                                        Style="{StaticResource A_Style_FZButton_BucketListTypeTile}">
                                </local:FZButton>

                                <local:FZButton x:Name="PART_Button_SkillScore"
                                        DataContext="{StaticResource A_MenuDataItem_SkillScore}"
                                        local:TileMenuNavigationManager.GridX="2"
                                        local:TileMenuNavigationManager.GridY="0"
                                        Style="{StaticResource A_Style_FZButton_BucketListTypeTile}"/>

                                <local:FZButton x:Name="PART_Button_Waypoint"
                                        DataContext="{StaticResource A_MenuDataItem_Waypoint}"
                                        local:TileMenuNavigationManager.GridX="4" 
                                        local:TileMenuNavigationManager.GridY="0"
                                        Style="{StaticResource A_Style_FZButton_BucketListTypeTile}" />

                                <local:FZButton x:Name="PART_Button_DangerSign"
                                        DataContext="{StaticResource A_MenuDataItem_DangerSign}"
                                        local:TileMenuNavigationManager.GridX="6" 
                                        local:TileMenuNavigationManager.GridY="0"
                                        Style="{StaticResource A_Style_FZButton_BucketListTypeTile}"/>

                                <local:FZButton x:Name="PART_Button_SkillDrive"
                                        DataContext="{StaticResource A_MenuDataItem_SkillDrive}"
                                        local:TileMenuNavigationManager.GridX="0" 
                                        local:TileMenuNavigationManager.GridY="2"
                                        Style="{StaticResource A_Style_FZButton_BucketListTypeTile}"/>

                                <local:FZButton x:Name="PART_Button_SkillMastery"
                                        DataContext="{StaticResource A_MenuDataItem_SkillMastery}"
                                        local:TileMenuNavigationManager.GridX="2" 
                                        local:TileMenuNavigationManager.GridY="2"
                                        Style="{StaticResource A_Style_FZButton_BucketListTypeTile}" />

                                <local:FZButton x:Name="PART_Button_DriftZone"
                                        DataContext="{StaticResource A_MenuDataItem_DriftZone}"
                                        local:TileMenuNavigationManager.GridX="4" 
                                        local:TileMenuNavigationManager.GridY="2"
                                        Style="{StaticResource A_Style_FZButton_BucketListTypeTile}" />

                                <local:FZButton x:Name="PART_Button_DamageControl"
                                        DataContext="{StaticResource A_MenuDataItem_DamageControl}"
                                        local:TileMenuNavigationManager.GridX="6" 
                                        local:TileMenuNavigationManager.GridY="2"
                                        Style="{StaticResource A_Style_FZButton_BucketListTypeTile}" />
                            </local:AutoSizeCanvas>
                        </Decorator>

                        <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}"
                                   Margin="4,0,0,0"
                                   VerticalAlignment="Top">
                            <ContentControl Style="{StaticResource A_Style_DescriptionPanel}"
                                        Width="324"
                                        Height="572"
                                        Margin="0"
                                        DataContext="{Binding (local:AttachedTileMenu.TileMenuNavigationManager).SelectedTile}"
                                        Content="{Binding DataContext.Description}"/>
                        </Decorator>
                    </StackPanel>
                </StackPanel>
            </Border>
        </Grid>
    </Grid>
</Page>