<Page
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:ForzaUI"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     
      DataContext="{Binding RelativeSource={RelativeSource Self}}"
      Style="{StaticResource A_Style_Page_Generic}"
      mc:Ignorable="d"
      x:Class="ForzaUI.Scenes.Anthem.A_ForzaEventsWeekly"
      >

    <Page.Resources>
        <DataTemplate x:Key="A_DataTemplate_WeeklyChallenge">
            <local:MultiItemLiveTile Style="{StaticResource A_Style_Button_ForzaEvents}" 
                                     Template="{StaticResource A_ControlTemplate_ForzaEvents_WeeklyMultiChallenge}" 
                                     Items="{Binding ChildChallenges}" 
                                     Height="715" 
                                     Width="426"
                                     ShouldAutoCycle="False"
                                     local:ControllerButtonPanel.RThumbLeftRightDescription="{local:Loc HelpButtons.IDS_CycleChapters}"/>
        </DataTemplate>

        <ControlTemplate x:Key="A_ControlTemplate_WeeklyChallengeList" TargetType="{x:Type local:CommonListBox}">
            <StackPanel IsItemsHost="True" Margin="0,6" Orientation="Horizontal"/>
        </ControlTemplate>

        <Style x:Key="A_Style_ListBoxItem_WeeklyChallenge" TargetType="{x:Type ListBoxItem}">
            <Setter Property="Focusable" Value="False"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <ContentPresenter Margin="4.5,0"/>
                        <ControlTemplate.Triggers>
                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsKeyboardFocusWithin}" Value="True">
                                <Setter Property="Panel.ZIndex" Value="1"/>
                            </DataTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Page.Resources>

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

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

        <local:PlayerBarControl Style="{StaticResource A_Style_PlayerBarControl}"
                        x:Name="TopBar" />
        <ContentControl Style="{StaticResource A_Style_ButtonBar}"
                        x:Name="BottomBar">
            <local:ControllerButtonPanel x:Name="HelpPanel"
                                         Style="{StaticResource A_Style_ControllerButtonPanel_Default}">
                <local:ControllerButtonControl Button="B" Description="{local:Loc HelpButtons.IDS_Back}"/>
                <local:ControllerButtonControl Style="{StaticResource A_ControllerButtonControl_RS_ForzaEvents_Controller}" />
                <local:ControllerButtonControl Style="{StaticResource A_ControllerButtonControl_RS_ForzaEvents_Keyboard}" />
            </local:ControllerButtonPanel>
        </ContentControl>

        <Border Style="{StaticResource A_Style_Border_ScenePadding}"
            x:Name="LayoutRoot">

            <Grid Style="{StaticResource A_Style_FrameworkElement_ScreenTilt}">
                <StackPanel HorizontalAlignment="Center"
                    Orientation="Vertical"
                    VerticalAlignment="Center">

                    <!-- Title -->
                    <Decorator HorizontalAlignment="Left"
                        Margin="0,9,0,0"
                        Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                        <ContentControl Content="{local:Loc ForzaEvents.IDS_WeeklyChallenges_Title}"
                            Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                            local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/ForzaEvents.png"
                            Focusable="False"/>
                    </Decorator>
                    <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                        <local:CommonListBox ItemsSource="{Binding WeeklyChallenges}"
                                Template="{StaticResource A_ControlTemplate_WeeklyChallengeList}"
                                ItemContainerStyle="{StaticResource A_Style_ListBoxItem_WeeklyChallenge}"
                                ItemTemplate="{StaticResource A_DataTemplate_WeeklyChallenge}"
                                Background="{x:Null}"
                                BorderThickness="0"
                                BorderBrush="{x:Null}"
                                KeyboardNavigation.DirectionalNavigation="Contained"
                                local:FocusOnPageFocusGained.SelectorSelectedItem="True"/>
                    </Decorator>
                </StackPanel>
            </Grid>

        </Border>
    </Grid>
</Page>
