<Page xmlns:local="clr-namespace:ForzaUI"
      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.Scenes.Anthem.A_BucketListProgress"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}" Height="Auto" Width="Auto" Margin="0">
      
    <Page.Resources>
        <ResourceDictionary>
            <!-- Textures -->
            <ImageSource x:Key="A_ImageSource_ChallengeCompleteIcon">/ForzaUI;component/Textures/Anthem/Icons/Complete_Stamp.png</ImageSource>
            <ImageSource x:Key="A_ImageSource_ChallengeLockedIcon">/ForzaUI;component/Textures/Anthem/Icons/PauseMenu/Lock.png</ImageSource>

            <!-- Colors -->
            <Color x:Key="A_Color_ChallengeCompleteBackground">#FF6ABD46</Color>

            <System:Double x:Key="A_Double_BucketListChallenge_Width">330</System:Double>
            <System:Double x:Key="A_Double_BucketListChallenge_Height_Small">320</System:Double>
            <System:Double x:Key="A_Double_BucketListChallenge_Height_Large">640</System:Double>

            <System:Double x:Key="A_Double_BucketListChallenge_LockedOpacity">0.5</System:Double>

            <!-- Styles -->
            <Style x:Key="A_Style_HashSymbol" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}" >
                <Setter Property="FontSize" Value="58"/>
                <Setter Property="VerticalAlignment" Value="Bottom"/>
                <Setter Property="Margin" Value="0,0,0,0"/>
                <Setter Property="Color" Value="{StaticResource A_Color_Tile_Text}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding HasImage}" Value="True">
                        <Setter Property="Color" Value="{StaticResource A_Color_Tile_Text_Alternate}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Locked}" Value="True">
                        <Setter Property="Color" Value="{StaticResource A_Color_Tile_Title_Alternate}"/>
                        <Setter Property="Opacity" Value="{StaticResource A_Double_BucketListChallenge_LockedOpacity}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style> 

            <Style x:Key="A_Style_DisplayNumber" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}" >
                <Setter Property="FontSize" Value="117"/>
                <Setter Property="VerticalAlignment" Value="Bottom"/>
                <Setter Property="Margin" Value="2,-16,0,-16"/>
                <Setter Property="Color" Value="{StaticResource A_Color_Tile_Text}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding HasImage}" Value="True">
                        <Setter Property="Color" Value="{StaticResource A_Color_Tile_Text_Alternate}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Locked}" Value="True">
                        <Setter Property="Color" Value="{StaticResource A_Color_Tile_Title_Alternate}"/>
                        <Setter Property="Opacity" Value="{StaticResource A_Double_BucketListChallenge_LockedOpacity}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_Difficulty" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}" >
                <Setter Property="FontSize" Value="27"/>
                <Setter Property="Color" Value="{StaticResource A_Color_Tile_Text}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding HasImage}" Value="True">
                        <Setter Property="Color" Value="{StaticResource A_Color_Tile_Text_Alternate}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_DifficultyType" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}" >
                <Setter Property="FontSize" Value="27"/>
                <Setter Property="Color"
                        Value="{StaticResource A_Color_Bucketlist_DifficultyType}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding HasImage}" Value="True">
                        <Setter Property="Color" Value="{StaticResource A_Color_Tile_Text_Alternate}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_Description" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonD}" >
                <Setter Property="FontSize" Value="22"/>
                <Setter Property="Color" Value="{StaticResource A_Color_Tile_Text}"/>
                <Setter Property="LineHeight" Value="26" />
                <Setter Property="LineStackingStrategy" Value="BlockLineHeight" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding HasImage}" Value="True">
                        <Setter Property="Color" Value="{StaticResource A_Color_Tile_Text_Alternate}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_FZRun_Description_BOLD" TargetType="local:FZRun">
                <Setter Property="FontFamily" Value="Horizon_C" />
            </Style>

            <Style x:Key="A_Style_FZMaterial_CompletedIcon" TargetType="{x:Type local:FZMaterial}">
                <Setter Property="ImageSource" Value="{StaticResource A_ImageSource_ChallengeCompleteIcon}"/>
                <Setter Property="Width" Value="92"/>
                <Setter Property="Height" Value="84"/>
                <Setter Property="Visibility" Value="Collapsed"/>
                <Setter Property="Color" Value="{StaticResource A_Color_ChallengeCompleteBackground}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsComplete}" Value="True">
                        <Setter Property="Visibility" Value="Visible"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding HasImage}" Value="True">
                        <Setter Property="Color" Value="{StaticResource A_Color_WhitePanel}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_FZMaterial_LockedIcon" TargetType="{x:Type local:FZMaterial}">
                <Setter Property="ImageSource" Value="{StaticResource A_ImageSource_ChallengeLockedIcon}"/>
                <Setter Property="Width" Value="90"/>
                <Setter Property="Height" Value="90"/>
                <Setter Property="Visibility" Value="{Binding Locked, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"/>
                <Setter Property="Opacity" Value="{StaticResource A_Double_BucketListChallenge_LockedOpacity}"/>
                <Setter Property="HorizontalAlignment" Value="Left"/>
                <Setter Property="VerticalAlignment" Value="Bottom"/>
                <Setter Property="Preset" Value="{StaticResource A_FZMaterialPreset_Glossy}"/>
                <Setter Property="Margin" Value="0,0,11,15"/>
            </Style>

            <Style x:Key="A_Style_FZMaterial_BucketListChallengeBackground" TargetType="{x:Type local:FZMaterial}" BasedOn="{StaticResource A_Style_FZMaterial_AcrylicSurface_Tile_Background}">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Locked}" Value="True">
                        <Setter Property="Preset"
                                Value="{StaticResource A_FZMaterialPresetGlass_BodyPanel_AcrylicSurface}" />
                        <Setter Property="Color"
                                Value="{StaticResource A_Color_Acrylic_BodyPanel_Image}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_FZMaterial_BucketListChallengeImageBackground" TargetType="{x:Type local:FZMaterial}" BasedOn="{StaticResource A_Style_FZMaterial_BucketListChallengeBackground}">
                <Setter Property="ImageSource" Value="{Binding Image}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Locked}" Value="True">
                        <Setter Property="ImageSource"
                                Value="{Binding LockedImage}" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            
            <Style x:Key="A_Style_FZMaterial_ChallengeHightlight_Unselected"
                   TargetType="{x:Type local:FZMaterial}"
                   BasedOn="{StaticResource A_Style_FZMaterial_NoticeHightlight_Unselected}">
                <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetGlass_BodyPanel_AcrylicSurface}"/>
            </Style>

            <!-- Item Style -->
            <Style x:Key="A_Style_ListBoxItem_Notice" TargetType="{x:Type ListBoxItem}">
                <Setter Property="local:FocusOnMouseOverBehaviour.Self"
                        Value="True" />
            </Style>

            <Style x:Key="A_Style_CommonListBox_LargeScrollableNoticePanel_Challenges" TargetType="{x:Type local:CommonListBox}"
                BasedOn="{StaticResource A_Style_CommonListBox_LargeScrollableNoticePanel}">
                <Setter Property="local:BindingProxy.A">
                    <Setter.Value>
                        <Thickness>28,27,18,27</Thickness>
                    </Setter.Value>
                </Setter>
            </Style>

            <ControlTemplate x:Key="A_ControlTemplate_NoticeHighlight" TargetType="Control">
                <local:FZMaterial x:Name="A_FZMaterial_NoticeHighlight"
                                  Style="{StaticResource A_Style_FZMaterial_ChallengeHightlight_Unselected}"
                                  Width="20"/>
                <ControlTemplate.Triggers>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ContentControl}}, Path=IsFocused}" Value="True">
                        <Setter TargetName="A_FZMaterial_NoticeHighlight" Property="Style" Value="{StaticResource A_Style_FZMaterial_AcrylicPanel_Highlight}" />
                    </DataTrigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>

            <ControlTemplate x:Key="A_ControlTemplate_Challenge_Tile" TargetType="Control">
                <Grid>
                    <local:RoutedEventCommand x:Name="SelectChallengeRoutedEventCommand"
                                          RoutedEvent="UIElement.MouseLeftButtonUp"
                                          Command="{Binding SelectCommand, RelativeSource={RelativeSource AncestorType=Page}}" />
                    <DockPanel Width="{StaticResource A_Double_BucketListChallenge_Width}"
                               Margin="0,0,0,10"
                               local:RoutedEventCommand.Action="{Binding ElementName=SelectChallengeRoutedEventCommand}">
                        <Control Template="{StaticResource A_ControlTemplate_NoticeHighlight}" DockPanel.Dock="Left"/>
                        <Grid>
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_BucketListChallengeBackground}" Visibility="{Binding HasImage, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}"/>
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_BucketListChallengeImageBackground}" Visibility="{Binding HasImage, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"/>
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_CompletedIcon}"
                                              HorizontalAlignment="Right"
                                              VerticalAlignment="Top"
                                              Margin="15,18"/>
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_LockedIcon}"/>
                            <StackPanel Margin="16,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                                <Viewbox StretchDirection="DownOnly" HorizontalAlignment="Left">
                                    <StackPanel Orientation="Horizontal" Margin="0,0,0,0">
                                        <local:FZTextBlock 
                                            x:Name="A_FZTextBlock_Hash" 
                                            Text="{local:Loc BucketList.IDS_BucketList_Symbol}" 
                                            Style="{StaticResource A_Style_HashSymbol}"/>
                                        <local:FZTextBlock 
                                            x:Name="A_FZTextBlock_DisplayNumber" 
                                            Text="{Binding DisplayNumber}" 
                                            Style="{StaticResource A_Style_DisplayNumber}"/>
                                    </StackPanel>
                                </Viewbox>
                                <Viewbox StretchDirection="DownOnly"
                                         HorizontalAlignment="Left"
                                         Visibility="{Binding Locked, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}">
                                    <StackPanel Orientation="Horizontal" Margin="0,-10,0,0">
                                        <local:FZTextBlock 
                                            x:Name="A_FZTextBlock_Difficulty_Type" 
                                            Text="{local:Loc BucketList.IDS_Difficulty}" 
                                            Style="{StaticResource A_Style_Difficulty}" />
                                        <local:FZTextBlock 
                                            x:Name="A_FZTextBlock_Difficulty" 
                                            Text="{Binding Difficulty}" 
                                            Style="{StaticResource A_Style_DifficultyType}"
                                            Margin="3,0,0,0" />
                                    </StackPanel>
                                </Viewbox>
                            </StackPanel>
                            <local:FZTextBlock
                                x:Name="A_FZTextBlock_Description" 
                                local:TextBlockInlineMarkup.Markup="{Binding Description, Converter={StaticResource A_StringToUpper}}"
                                local:TextBlockInlineMarkup.ResourceBaseName="A_Style_FZRun_Description_"
                                Style="{StaticResource A_Style_Description}"
                                TextWrapping="Wrap"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Bottom"
                                MaxHeight="105"
                                Margin="18,0,18,8"
                                Visibility="{Binding Locked, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}"/>
                        </Grid>
                    </DockPanel>
                </Grid>
            </ControlTemplate>
            
            <!-- Normal challenge style-->
            <DataTemplate x:Key="A_DataTemplate_Normal_Small">
                <Control Template="{StaticResource A_ControlTemplate_Challenge_Tile}"
                         Height="{StaticResource A_Double_BucketListChallenge_Height_Small}"/>
            </DataTemplate>

            <!-- Completed challenge style -->
            <DataTemplate x:Key="A_DataTemplate_Completed_Small">
                <Control Template="{StaticResource A_ControlTemplate_Challenge_Tile}"
                         Height="{StaticResource A_Double_BucketListChallenge_Height_Small}"/>
            </DataTemplate>

            <!-- Large completed challenge -->
            <DataTemplate x:Key="A_DataTemplate_Completed_Large">
                <Control Template="{StaticResource A_ControlTemplate_Challenge_Tile}"
                         Height="{StaticResource A_Double_BucketListChallenge_Height_Large}"/>
            </DataTemplate>

            <!-- Normal with image challenge -->
            <DataTemplate x:Key="A_DataTemplate_Normal_Large">
                <Control Template="{StaticResource A_ControlTemplate_Challenge_Tile}"
                         Height="{StaticResource A_Double_BucketListChallenge_Height_Large}"/>
            </DataTemplate>

      <local:ChallengeTypeSelector
        NormalTemplate="{StaticResource A_DataTemplate_Normal_Small}" 
        CompleteTemplate="{StaticResource A_DataTemplate_Completed_Small}" 
        CompleteLargeTemplate="{StaticResource A_DataTemplate_Completed_Large}" 
        ImageTemplate="{StaticResource A_DataTemplate_Normal_Large}"
        x:Key="ChallengeTemplateSelector" />

            <ItemsPanelTemplate x:Key="A_Panel_Notices">
                <local:NoticePanel 
                    NumColumns="4"
                    ArrangeMethod="ShortestColumn"
                    IsAtTop="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ContentControl, AncestorLevel=2}, Path=(local:FZScrollViewer.IsAtTop), Mode=OneWayToSource}" 
                    IsAtBottom="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ContentControl, AncestorLevel=2}, Path=(local:FZScrollViewer.IsAtBottom), Mode=OneWayToSource}"
                    TopScrollOffset="25"
                    BottomScrollOffset="25"
                />
            </ItemsPanelTemplate>

        </ResourceDictionary>
    </Page.Resources>

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

    <Grid>
       <Control Style="{StaticResource A_Style_Control_ScreenBackground}" />
        <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="{Binding AButtonDescription}"
                    local:ControllerButtonPanel.YDescription="{Binding YButtonDescription}"
                    local:ControllerButtonPanel.BDescription="{local:Loc HelpButtons.IDS_Back}"
                    Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}" />
        </ContentControl>

        <Border x:Name="LayoutRoot" Style="{StaticResource A_Style_Border_ScenePadding}">
            <Decorator Style="{StaticResource A_Style_FrameworkElement_ScreenTilt}">
                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="19,50,0,0">
                    <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                        <ContentControl x:Name="ContentControl_SceneTitle" 
                                        Content="{local:Loc ScreenTitles.IDS_BucketList}" 
                                        Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}" 
                                        HorizontalAlignment="Left"
                                        local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/BucketList.png"/>
                    </Decorator>
    
                    <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_1}"
                               Margin="1,0,0,0"
                               HorizontalAlignment="Center">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_LargeScrollablePanel}">
                                <local:CommonListBox x:Name="A_ListBox_Challenges" VerticalAlignment="Center" BorderThickness="0" Width="1409" MaxHeight="744"
                                    ItemsSource="{Binding Challenges}"
                                    ItemContainerStyle="{StaticResource A_Style_ListBoxItem_Notice}"
                                    ItemTemplateSelector="{StaticResource ChallengeTemplateSelector}"
                                    ItemsPanel="{StaticResource A_Panel_Notices}"
                                    Style="{StaticResource A_Style_CommonListBox_LargeScrollableNoticePanel_Challenges}"
                                    SelectedIndex="0" Padding="0" HorizontalAlignment="Center"/>
                        </ContentControl>
                    </Decorator>
                </StackPanel>
            </Decorator>
        </Border>
    </Grid>
</Page>
