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

    <Page.Resources>
        <ResourceDictionary>

            <!-- BucketList info Style -->
            <Style x:Key="A_Style_ContentControl_BucketListBlueprint_Carousel_RaiseFocusedItem"
                   TargetType="ContentControl">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ContentControl}">
                            <ControlTemplate.Resources>
                                <Storyboard x:Key="SelectItemStory">
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
                                                           Storyboard.TargetName="ScaledContainer">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="1.03" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
                                                           Storyboard.TargetName="ScaledContainer">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="1.03" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(local:ZPanel.ZOffset)"
                                                           Storyboard.TargetName="ScaledContainer">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="{StaticResource A_Double_ZOffset_Acrylic}" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                                           Storyboard.TargetName="FocusHighlight">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="1" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                                           Storyboard.TargetName="DropShadow">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0"
                                                      Value="0" />
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="0.6" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
                                                           Storyboard.TargetName="DropShadow">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0"
                                                      Value="0.75" />
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="1.06" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
                                                           Storyboard.TargetName="DropShadow">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0"
                                                      Value="0.75" />
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="1.06" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"
                                                           Storyboard.TargetName="DropShadow">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="0" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"
                                                           Storyboard.TargetName="DropShadow">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="0" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <Int32AnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.ZIndex)"
                                                          Storyboard.Target="{Binding RelativeSource={RelativeSource AncestorType=ContentPresenter}}">
                                        <EasingInt32KeyFrame KeyTime="0:0:0.3"
                                                     Value="20" />
                                    </Int32AnimationUsingKeyFrames>
                                </Storyboard>
                                <Storyboard x:Key="DeselectItemStory">
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
                                                           Storyboard.TargetName="ScaledContainer">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="1.0" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
                                                           Storyboard.TargetName="ScaledContainer">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="1.0" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(local:ZPanel.ZOffset)"
                                                           Storyboard.TargetName="ScaledContainer">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="0.0" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                                           Storyboard.TargetName="FocusHighlight">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="0" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                                           Storyboard.TargetName="DropShadow">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="0" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
                                                           Storyboard.TargetName="DropShadow">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="0.75" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
                                                           Storyboard.TargetName="DropShadow">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                                      Value="0.75" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <Int32AnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.ZIndex)"
                                                          Storyboard.Target="{Binding RelativeSource={RelativeSource AncestorType=ContentPresenter}}">
                                        <EasingInt32KeyFrame KeyTime="0:0:0.3"
                                                     Value="0" />
                                    </Int32AnimationUsingKeyFrames>
                                </Storyboard>
                                <Storyboard x:Key="TransitionOut" />
                            </ControlTemplate.Resources>
                            <Grid x:Name="OuterContainer"
                                  Margin="{StaticResource A_Thickness_LargeCarouselTileMargin}">
                                <Grid>
                                    <local:FZMaterial x:Name="DropShadow"
                                              Style="{StaticResource A_Style_FZMaterial_ShadowBase_ForSubgraph}">
                                        <local:FZMaterial.RenderTransform>
                                            <TransformGroup>
                                                <ScaleTransform ScaleX="0"
                                                        ScaleY="0" />
                                                <SkewTransform />
                                                <RotateTransform />
                                                <TranslateTransform />
                                            </TransformGroup>
                                        </local:FZMaterial.RenderTransform>
                                    </local:FZMaterial>
                                </Grid>
                                <Grid x:Name="ScaledContainer"
                                      RenderTransformOrigin="0.5,0.5"
                                      local:ZPanel.ZOffset="0">
                                    <Grid.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform />
                                            <SkewTransform />
                                            <RotateTransform />
                                            <TranslateTransform />
                                        </TransformGroup>
                                    </Grid.RenderTransform>
                                    <local:FZMaterial x:Name="FocusHighlight"
                                                      Style="{StaticResource A_Style_FZMaterial_TileSelectionStroke}"
                                                      local:ZPanel.DisableClipping="True"/>
                                    <ContentPresenter/>
                                    <ContentControl x:Name="MouseRollover"
                                                    Style="{StaticResource A_Style_Control_MouseRollover}" />
                                    <local:RoutedEventCommand x:Name="ClickOnMouseItem"
                                                              RoutedEvent="UIElement.MouseLeftButtonDown">
                                        <local:RoutedEventCommand.Style>
                                            <Style TargetType="local:RoutedEventCommand">
                                                <Setter Property="Command"
                                                        Value="{Binding SelectCommand, RelativeSource={RelativeSource AncestorType=Page}}" />
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding (Selector.IsSelected), RelativeSource={RelativeSource AncestorType=ContentControl}}"
                                                                 Value="False">
                                                        <Setter Property="Command"
                                                                Value="{x:Null}" />
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </local:RoutedEventCommand.Style>
                                    </local:RoutedEventCommand>
                                    <local:FZMaterial x:Name="MouseHitHelper"
                                                      Color="#00000000"
                                                      GreedyMeasure="True"
                                                      local:RoutedEventCommand.Action="{Binding ElementName=ClickOnMouseItem}"/>
                                </Grid>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <DataTrigger Binding="{Binding (Selector.IsSelected), RelativeSource={RelativeSource Self}}"
                                     Value="True">
                                    <DataTrigger.ExitActions>
                                        <BeginStoryboard x:Name="HideSelected_BeginStoryboard2"
                                                 HandoffBehavior="SnapshotAndReplace"
                                                 Storyboard="{StaticResource DeselectItemStory}" />
                                    </DataTrigger.ExitActions>
                                    <DataTrigger.EnterActions>
                                        <BeginStoryboard x:Name="ShowSelected_BeginStoryboard2"
                                                 HandoffBehavior="SnapshotAndReplace"
                                                 Storyboard="{StaticResource SelectItemStory}" />
                                    </DataTrigger.EnterActions>
                                </DataTrigger>
                                <DataTrigger Binding="{Binding IsEnabled, RelativeSource={RelativeSource TemplatedParent}}"
                                     Value="False">
                                    <DataTrigger.EnterActions>
                                        <BeginStoryboard x:Name="HideItems_BeginStoryboard"
                                                 Storyboard="{StaticResource TransitionOut}" />
                                    </DataTrigger.EnterActions>
                                </DataTrigger>
                                <DataTrigger Binding="{Binding (Selector.IsMouseOver), RelativeSource={RelativeSource Self}}"
                                             Value="True">
                                    <Setter TargetName="MouseRollover"
                                            Property="Visibility"
                                            Value="Visible" />
                                </DataTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="A_Style_FZTextBlock_BlueprintText" TargetType="local:FZTextBlock"
                   BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}">
                <Setter Property="Color" Value="{StaticResource A_Color_Tile_Title_Alternate}" />
                <Setter Property="FontSize" Value="48" />
                <Setter Property="TextWrapping" Value="Wrap" />
                <Setter Property="LineHeight" Value="48.0" />
                <Setter Property="LineStackingStrategy" Value="BlockLineHeight" />
            </Style>

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

            <!-- Bucket list tile datatemplates -->
            <DataTemplate DataType="{x:Type local:BucketListChallengeCarouselItem}">
                <Viewbox Width="{StaticResource A_Double_LargeCarouselTileWidth}" Height="{StaticResource A_Double_LargeCarouselTileHeight}">
                    <Control Style="{StaticResource A_Style_Control_BucketListFlyer}" DataContext="{Binding SetupItem}" />
                </Viewbox>
            </DataTemplate>

            <DataTemplate DataType="{x:Type local:BucketListBlueprintOptionCarouselItem}">
                <Grid>
                    <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Anthem/TileBackgrounds/BucketlistBlueprint.png"/>
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_BlueprintText}"
                            local:TextBlockInlineMarkup.Markup="{local:Loc BucketListBlueprint.IDS_CreateBlueprintOptionLabel}"
                            local:TextBlockInlineMarkup.ResourceBaseName="A_FZRun_Blueprint_"
							Margin="25,30" />
                </Grid>
            </DataTemplate>

            <DataTemplate DataType="{x:Type local:BucketListLoadingCarouselItem}">
                <Grid>
                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_AcrylicPanel_EmptyItem}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
                    <ProgressBar Style="{StaticResource A_Style_ProgressBar_WaitSpinner}" Width="64" Height="64" IsIndeterminate="True"/>
                </Grid>
            </DataTemplate>

        </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}" />

        <local:NetworkCountdownControl Style="{StaticResource A_Style_NetworkCountdownControl_BucketListSetup}" />

        <Border x:Name="LayoutRoot"
                Style="{StaticResource A_Style_Border_ScenePadding}"
                ClipToBounds="false">
            <Grid Style="{StaticResource A_Style_FrameworkElement_ScreenTilt}"
                  ClipToBounds="false">
                <StackPanel Margin="0,120,0,0" VerticalAlignment="Stretch" HorizontalAlignment="Center" ClipToBounds="false">
                    <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}"
                               Margin="38,0,0,0">
                        <ContentControl x:Name="ContentControl_SceneTitle"
                                        Content="{local:Loc ScreenTitles.IDS_BucketListBlueprint}"
                                        Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                        HorizontalAlignment="Left"
                                        local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Blueprint.png"/>
                    </Decorator>

                    <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_1}">
                        <local:CommonListBox x:Name="A_ListBox_Challenges"
                                             ItemsSource="{Binding Challenges}"
                                             ItemContainerStyle="{StaticResource A_Style_ContentControl_BucketListBlueprint_Carousel_RaiseFocusedItem}"
                                             Style="{StaticResource A_Style_LargeCarousel3ItemList}"
                                             ScrollViewer.CanContentScroll="true"
                                             HorizontalAlignment="Center"/>
                    </Decorator>
                </StackPanel>
            </Grid>
        </Border>

        <ContentControl Style="{StaticResource A_Style_ButtonBar}"
                        x:Name="BottomBar">
            <local:ControllerButtonPanel x:Name="HelpPanel"
                                         Style="{StaticResource A_Style_ControllerButtonPanel_Default}">
                <local:ControllerButtonControl Button="A"
                                               Description="{local:Loc HelpButtons.IDS_Select}"
                                               Visibility="{Binding SelectedItem, FallbackValue=Collapsed, ElementName=A_ListBox_Challenges, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"/>
                <local:ControllerButtonControl Button="B"
                                               Description="{local:Loc HelpButtons.IDS_Back}"/>
                <local:ControllerButtonControl Button="X"
                                               Description="{local:Loc HelpButtons.IDS_BucketListChallenges}"/>
                <local:ControllerButtonControl Button="Y"
                                               Description="{local:Loc HelpButtons.IDS_BucketListBlueprintOptions}"
                                               Visibility="{Binding SelectedItem.AnyOptionsAvailable, FallbackValue=Collapsed, ElementName=A_ListBox_Challenges, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"/>
            </local:ControllerButtonPanel>
        </ContentControl>
    </Grid>
</Page>
