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

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

    <Page.Resources>
        <ResourceDictionary>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_EditTitle"
                                      Heading="{local:Loc BucketListBlueprint.IDS_ShareOptions_TileTitle_EditTitle}"
                                      Icon="/ForzaUI;component/Textures/Data_Bound/SuperChallenges/Title_Icon.png"
                                      Description="{local:Loc BucketListBlueprint.IDS_ShareOptions_TileDescription_EditTitle}"/>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_EditDescription"
                                      Heading="{local:Loc BucketListBlueprint.IDS_ShareOptions_TileTitle_EditDescription}"
                                      Icon="/ForzaUI;component/Textures/Data_Bound/SuperChallenges/Description_Icon.png"
                                      Description="{local:Loc BucketListBlueprint.IDS_ShareOptions_TileDescription_EditDescription}"/>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_AdjustTimeLimit"
                                      Heading="{local:Loc BucketListBlueprint.IDS_ShareOptions_TileTitle_AdjustTimeLimit}"
                                      Icon="/ForzaUI;component/Textures/Data_Bound/SuperChallenges/TimeLimit_Icon.png"
                                      Description="{local:Loc BucketListBlueprint.IDS_ShareOptions_TileDescription_AdjustTimeLimit}"/>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_ChallengeSettings"
                                      Heading="{local:Loc BucketListBlueprint.IDS_ShareOptions_TileTitle_EditChallengeSettings}"
                                      Icon="/ForzaUI;component/Textures/Data_Bound/SuperChallenges/Settings_Icon.png"
                                      Description="{local:Loc BucketListBlueprint.IDS_ShareOptions_TileDescription_EditChallengeSettings}"/>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_Retry"
                                      Heading="{local:Loc BucketListBlueprint.IDS_ShareOptions_TileTitle_Retry}"
                                      Icon="/ForzaUI;component/Textures/Data_Bound/SuperChallenges/Retry_Icon.png"
                                      Description="{local:Loc BucketListBlueprint.IDS_ShareOptions_TileDescription_Retry}"/>
            <local:TileMenuDataItem x:Key="A_MenuDataItem_PublishBucketList"
                                      Heading="{local:Loc BucketListBlueprint.IDS_ShareOptions_TileTitle_PublishBucketList}"
                                      Icon="/ForzaUI;component/Textures/Data_Bound/SuperChallenges/Publish_Icon.png"
                                      Description="{local:Loc BucketListBlueprint.IDS_ShareOptions_TileDescription_PublishBucketList}"/>

            <Style x:Key="A_Style_FZMaterial_LockableBucketListBlueprintTile" TargetType="local:FZMaterial" BasedOn="{StaticResource A_Style_FZMaterial_FlatPanel_Tile}">
                <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_Interactive}"/>
                        <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterAll}"/>
                    </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_TileDropShadow}"/>
                    <local:FZMaterial x:Name="BackingTile" Style="{StaticResource A_Style_FZMaterial_LockableBucketListBlueprintTile}"/>

                    <ContentPresenter/>

                    <Decorator VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Margin="12,12,12,24">
                        <local:FZTextBlock x:Name="TitleText" Style="{StaticResource A_Style_FZTextBlock_TileTitle}" CapHeight="19" HorizontalAlignment="Center" Margin="0,10" Color="#FF969696"/>
                    </Decorator>
                    <ContentControl Style="{StaticResource A_Style_ContentControl_TileSelectionStroke}" />
                </Grid>
            </ControlTemplate>

            <DataTemplate x:Key="A_ControlTemplate_BucketListType_TileContent">
                <Grid>
                    <local:FZMaterial x:Name="PadLock" Margin="6" Width="36" Height="36" VerticalAlignment="Top" HorizontalAlignment="Left" 
                                      Visibility="Hidden"
                                      Color="{StaticResource A_Color_Tile_Background_Locked}" Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerAll}">
                        <local:FZMaterial Width="27" Height="28" Margin="9,8" HorizontalAlignment="Center" VerticalAlignment="Center"
                                          ImageSource="/ForzaUI;component/Textures/Anthem/Icons/Pad_Lock.png"/>
                    </local:FZMaterial>

                    <local:FZMaterial x:Name="Icon" Color="{StaticResource A_Color_SmallTile_Icon}" Style="{StaticResource A_Style_FZMaterial_LockableImageTileBackground}"/>
                </Grid>
                <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding (local:TileMenuNavigationManager.LockState), RelativeSource={RelativeSource FindAncestor, AncestorType=Button}}" Value="{x:Static local:LockState.Locked}">
                        <Setter TargetName="Icon" Property="Color" Value="{StaticResource A_Color_White}"/>
                        <Setter TargetName="PadLock" Property="Visibility" Value="Visible"/>
                    </DataTrigger>
                </DataTemplate.Triggers>
            </DataTemplate>

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

            <Style x:Key="A_Style_FZButton_BucketListShareTile" TargetType="local:FZButton" BasedOn="{StaticResource A_Style_Button_RootTile}">
                <Setter Property="Width" Value="240"/>
                <Setter Property="Height" Value="240"/>
                <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>

            <Style x:Key="A_Style_FZTextBlock_DescriptionBlock" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_DescriptionBlockBody}">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsKeyboardFocusWithin, ElementName=PART_Button_EditTitle}"
                                 Value="True">
                        <Setter Property="Text"
                                Value="{Binding DataContext.Description, ElementName=PART_Button_EditTitle}" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding IsKeyboardFocusWithin, ElementName=PART_Button_EditDescription}"
                                 Value="True">
                        <Setter Property="Text"
                                Value="{Binding DataContext.Description, ElementName=PART_Button_EditDescription}" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding IsKeyboardFocusWithin, ElementName=PART_Button_Retry}"
                                 Value="True">
                        <Setter Property="Text"
                                Value="{Binding DataContext.Description, ElementName=PART_Button_Retry}" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding IsKeyboardFocusWithin, ElementName=PART_Button_ChallengeSettings}"
                                 Value="True">
                        <Setter Property="Text"
                                Value="{Binding DataContext.Description, ElementName=PART_Button_ChallengeSettings}" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding IsKeyboardFocusWithin, ElementName=PART_Button_AdjustTimeLimit}"
                                 Value="True">
                        <Setter Property="Text"
                                Value="{Binding DataContext.Description, ElementName=PART_Button_AdjustTimeLimit}" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding IsKeyboardFocusWithin, ElementName=PART_Button_PublishBucketList}"
                                 Value="True">
                        <Setter Property="Text"
                                Value="{Binding DataContext.Description, ElementName=PART_Button_PublishBucketList}" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <local:FZMaterialPresetGlassRoundtangle x:Key="A_FZMaterialPresetGlassRoundtangle_GlassPanel_FlyerBorder"
                                                    BasedOn="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_Base}"
                                                    CornerRadius="12,12,12,12"/>
        </ResourceDictionary>
    </Page.Resources>

    <Grid>
        <!-- Background Blur -->
        <Control Template="{StaticResource A_ControlTemplate_Blueprint_Background}"/>

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

        <Grid x:Name="LayoutRoot"
              Margin="0,100,0,0">
            <Border Style="{StaticResource A_Style_Border_ScenePadding}">
                <StackPanel Orientation="Vertical" Margin="-7,-23,0,0" VerticalAlignment="Center" HorizontalAlignment="Center">
                    <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}"
                               HorizontalAlignment="Left">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                            Content="{local:Loc ScreenTitles.IDS_BucketListBlueprintShareOptions}"
                            local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Blueprint.png"
                            HorizontalAlignment="Left" />
                    </Decorator>
                    <DockPanel>
                        <StackPanel DockPanel.Dock="Left"
                                    Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_1}"
                                    Panel.ZIndex="10">
                            <Decorator x:Name="PART_MenuContent"
                                       HorizontalAlignment="Left"
                                       Margin="0,0,88,0">

                                <local:AutoSizeCanvas x:Name="PART_SCOPE_Home">
                                    <local:FZButton x:Name="PART_Button_EditTitle"
                                        DataContext="{StaticResource A_MenuDataItem_EditTitle}"
                                        local:TileMenuNavigationManager.GridX="0"
                                        local:TileMenuNavigationManager.GridY="0"
                                        Style="{StaticResource A_Style_FZButton_BucketListShareTile}" 
                                        local:UIPageTransitionManager.TransitionIndex="0">
                                    </local:FZButton>

                                    <local:FZButton x:Name="PART_Button_EditDescription"
                                        DataContext="{StaticResource A_MenuDataItem_EditDescription}"
                                        local:TileMenuNavigationManager.GridX="2"
                                        local:TileMenuNavigationManager.GridY="0"
                                        Style="{StaticResource A_Style_FZButton_BucketListShareTile}" 
                                        local:UIPageTransitionManager.TransitionIndex="1">
                                    </local:FZButton>

                                    <local:FZButton x:Name="PART_Button_Retry"
                                        DataContext="{StaticResource A_MenuDataItem_Retry}"
                                        local:TileMenuNavigationManager.GridX="4"
                                        local:TileMenuNavigationManager.GridY="0"
                                        Style="{StaticResource A_Style_FZButton_BucketListShareTile}" 
                                        local:UIPageTransitionManager.TransitionIndex="2">
                                    </local:FZButton>

                                    <local:FZButton x:Name="PART_Button_ChallengeSettings"
                                        DataContext="{StaticResource A_MenuDataItem_ChallengeSettings}"
                                        local:TileMenuNavigationManager.GridX="0"
                                        local:TileMenuNavigationManager.GridY="2"
                                        Style="{StaticResource A_Style_FZButton_BucketListShareTile}" 
                                        local:UIPageTransitionManager.TransitionIndex="3"/>

                                    <local:FZButton x:Name="PART_Button_AdjustTimeLimit"
                                        DataContext="{StaticResource A_MenuDataItem_AdjustTimeLimit}"
                                        local:TileMenuNavigationManager.GridX="2"
                                        local:TileMenuNavigationManager.GridY="2"
                                        Style="{StaticResource A_Style_FZButton_BucketListShareTile}" 
                                        local:UIPageTransitionManager.TransitionIndex="4"/>

                                    <local:FZButton x:Name="PART_Button_PublishBucketList"
                                        DataContext="{StaticResource A_MenuDataItem_PublishBucketList}"
                                        local:TileMenuNavigationManager.GridX="4"
                                        local:TileMenuNavigationManager.GridY="2"
                                        Style="{StaticResource A_Style_FZButton_BucketListShareTile}" 
                                        local:UIPageTransitionManager.TransitionIndex="5"/>

                                </local:AutoSizeCanvas>
                            </Decorator>
                            <Decorator Height="24" />
                            <local:FZMaterial MinHeight="81"
                                              Width="732"
                                              Color="#33000000"
                                              Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}"
                                              HorizontalAlignment="Left">
                                <Decorator Margin="16">
                                    <local:FZTextBlock x:Name="DescriptionPanelText"
                                                       Style="{StaticResource A_Style_FZTextBlock_DescriptionBlock}" />
                                </Decorator>
                            </local:FZMaterial>
                        </StackPanel>
                        
                        <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_2}">
                            <Grid HorizontalAlignment="Center" VerticalAlignment="Center"
                                  Margin="0,-100,0,0">
                                <local:FZMaterialGlassCapture />
                                <local:FZMaterial Preset="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_FlyerBorder}" 
                                                  Color="{StaticResource A_Color_GlassPanel_NonInteractive}"
                                                  Margin="-1" />
                                <Viewbox Stretch="Uniform" StretchDirection="DownOnly" Height="732">
                                    <Control Template="{StaticResource A_ControlTemplate_Control_BucketListFlyer_Internal}" 
                                             DataContext="{Binding BucketListSetup}"
                                             FontSize="{StaticResource A_Double_FlyerRotation_FrontFaceShowing}"/>
                                </Viewbox>
                            </Grid>
                        </Decorator>
                    </DockPanel>
                </StackPanel>
            </Border>
        </Grid>
    </Grid>
</Page>
