<Page x:Class="ForzaUI.Scenes.Anthem.A_CampaignEventSelect"
      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"
      mc:Ignorable="d"
      xmlns:local="clr-namespace:ForzaUI;assembly="
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">

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

    <Page.Resources>

        <System:Double x:Key="A_Double_Carousel_Tile_Width">480</System:Double>
        <System:Double x:Key="A_Double_Carousel_Tile_Height_with_margin">712</System:Double>
        <System:Double x:Key="A_Double_Carousel_Tile_Height">708</System:Double>

        <ControlTemplate x:Key="A_Template_EventTitleBlock"
                         TargetType="Control">
            <DockPanel VerticalAlignment="Bottom" Margin="0,0,0,76" MaxHeight="140">
                <local:FZTextBlock DockPanel.Dock="Top"
                    MaxWidth="350"
                    MaxHeight="90"
                    Style="{StaticResource A_Style_TextBlock_CampaignSetupFlyer_Heading_Base}"
                    Text="{Binding Title, Converter={StaticResource A_StringToUpper}}"/>
                <local:FZTextBlock Style="{StaticResource A_Style_TextBlock_CampaignSetupFlyer_Description}"
                    Margin="8,16,8,0"
                    Text="{Binding Subtitle}"/>
            </DockPanel>
        </ControlTemplate>

        <Style x:Key="A_Style_FZMaterial_EventSelect_MainContent"
               TargetType="local:FZMaterial"
               BasedOn="{StaticResource A_Style_FZMaterial_FlatPanel_Tile}">
        </Style>

        <local:EventBlueprintFlyerTemplateSelector x:Key="A_EventSelect_FlyerTemplateSelector" DataTemplateBaseName="A_DataTemplate_CampaignSetup_Tile" />
        
        <Style x:Key="H_Run_Tile_SecondaryText_BLUEPRINT"
            TargetType="FZRun">
            <Setter Property="Color" Value="{StaticResource H_Color_Primary_Pink}"/>
        </Style>

        <local:StringSubstitutionConverter x:Key="A_Converter_NewlinesToVoicedLineSeparator_Space">
            <local:StringSubstitution Find="&#x0a;" Replace="{local:Loc Main.IDS_ScreenReader_VoiceLineSeparatorSpace}"/>
        </local:StringSubstitutionConverter>
        <DataTemplate DataType="{x:Type local:CampaignEventSelectFixedImage}">
            <Grid Style="{StaticResource A_Style_FrameworkElement_DefaultTransition}"
                  local:UIPageTransitionManager.TransitionIndex="{Binding (local:UIPageTransitionManager.TransitionIndex), RelativeSource={RelativeSource TemplatedParent}}"
                  Width="{StaticResource A_Double_Carousel_Tile_Width}"
                  Height="{StaticResource A_Double_Carousel_Tile_Height}">
                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_EventSelect_MainContent}"
                                      ImageSource="{Binding Image}"/>

                <Control Template="{StaticResource A_Template_EventTitleBlock}"/>

                <FrameworkElement local:ScreenReader.Event="OnChange"
                                  local:ScreenReader.ControlType="Button"
                                  local:ScreenReader.LineType="SelectedItem">
                    <FrameworkElement.Style>
                        <Style TargetType="{Type FrameworkElement}">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}" Value="True">
                                    <Setter Property="local:ScreenReader.Line" Value="{Binding Title, Converter={StaticResource A_Converter_NewlinesToVoicedLineSeparator_Space}}"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </FrameworkElement.Style>
                </FrameworkElement>
            </Grid>
        </DataTemplate>

         <DataTemplate DataType="{x:Type local:CampaignEventSelectRaceMode}">
            <DataTemplate.Resources>
                <MappingConverter x:Key="A_Converter_RaceModeToFooterIncompleteImagePath">
                    <MappingConverterEntry Key="{Static RaceMode.RallyRace}" Value="game:\Media\UI\Textures\Data_Bound\PDLC2\Event_Blueprint\TimeTrial.png"/>
                    <MappingConverterEntry Key="{Static RaceMode.RallyCross}" Value="game:\Media\UI\Textures\Data_Bound\PDLC2\Event_Blueprint\Rally_Race.png"/>
                </MappingConverter>
                <MappingConverter x:Key="A_Converter_RaceModeToFooterCompleteImagePath">
                    <MappingConverterEntry Key="{Static RaceMode.RallyRace}" Value="game:\Media\UI\Textures\Data_Bound\PDLC2\Event_Blueprint\TimeTrial_Complete.png"/>
                    <MappingConverterEntry Key="{Static RaceMode.RallyCross}" Value="game:\Media\UI\Textures\Data_Bound\PDLC2\Event_Blueprint\Rally_Race_Complete.png"/>
                </MappingConverter>
                <MappingConverter x:Key="A_Converter_RaceModeToFooterLockedImagePath">
                    <MappingConverterEntry Key="{Static RaceMode.RallyRace}" Value="game:\Media\UI\Textures\Data_Bound\PDLC2\Event_Blueprint\TimeTrial_Locked.png"/>
                    <MappingConverterEntry Key="{Static RaceMode.RallyCross}" Value="game:\Media\UI\Textures\Data_Bound\PDLC2\Event_Blueprint\Rally_Race_Locked.png"/>
                </MappingConverter>
                <MappingConverter x:Key="A_Converter_AltenationIndexToOverlapMargin">
                    <MappingConverterEntry Key="0" Value="0,0,-8.5,0"/>
                    <MappingConverterEntry Key="1" Value="-8.5,0,0,0"/>
                </MappingConverter>
                <local:MappingConverter x:Key="A_Converter_ProgressionThreadToFlyerBackground" Default="game:\Media\UI\Textures\Data_Bound\Event_Blueprint\Backgrounds\RallyRaceType\mixed_rally.png">
                    <local:MappingConverterEntry Key="dirt_rally" Value="game:\Media\UI\Textures\Data_Bound\Event_Blueprint\Backgrounds\RallyRaceType\dirt_rally.png" />
                    <local:MappingConverterEntry Key="mixed_rally" Value="game:\Media\UI\Textures\Data_Bound\Event_Blueprint\Backgrounds\RallyRaceType\mixed_rally.png" />
                    <local:MappingConverterEntry Key="road_rally" Value="game:\Media\UI\Textures\Data_Bound\Event_Blueprint\Backgrounds\RallyRaceType\road_rally.png" />
                    <local:MappingConverterEntry Key="street_dirt_rally" Value="game:\Media\UI\Textures\Data_Bound\Event_Blueprint\Backgrounds\RallyRaceType\street_dirt_rally.png" />
                    <local:MappingConverterEntry Key="street_mixed_rally" Value="game:\Media\UI\Textures\Data_Bound\Event_Blueprint\Backgrounds\RallyRaceType\street_mixed_rally.png" />
                    <local:MappingConverterEntry Key="street_road_rally" Value="game:\Media\UI\Textures\Data_Bound\Event_Blueprint\Backgrounds\RallyRaceType\street_road_rally.png" />
                    <local:MappingConverterEntry Key="rally_boss_battle_dirt" Value="game:\Media\UI\Textures\Data_Bound\Event_Blueprint\Backgrounds\RallyRaceType\rally_boss_battle_dirt.png" />
                    <local:MappingConverterEntry Key="rally_boss_battle_road" Value="game:\Media\UI\Textures\Data_Bound\Event_Blueprint\Backgrounds\RallyRaceType\rally_boss_battle_road.png" />
                    <local:MappingConverterEntry Key="rally_boss_battle_street" Value="game:\Media\UI\Textures\Data_Bound\Event_Blueprint\Backgrounds\RallyRaceType\rally_boss_battle_street.png" />
                </local:MappingConverter>
            </DataTemplate.Resources>
            <Grid Style="{StaticResource A_Style_FrameworkElement_DefaultTransition}"
                  local:UIPageTransitionManager.TransitionIndex="{Binding (local:UIPageTransitionManager.TransitionIndex), RelativeSource={RelativeSource TemplatedParent}}"
                  Width="{StaticResource A_Double_Carousel_Tile_Width}"
                  Height="{StaticResource A_Double_Carousel_Tile_Height}">
                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_EventSelect_MainContent}"
                                  ImageSource="{Binding ProgressionThread, Converter={StaticResource A_Converter_ProgressionThreadToFlyerBackground}}"/>

                <Grid Margin="62,72,62,62">
                    <StackPanel Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Center">
                        <local:FZTextBlock x:Name="CreatorNameText"
                                           Text="{Binding Source={Loc Festival.IDS_FestivalName_Falcon}, Converter={StaticResource A_StringToUpper}}"
                                           Style="{StaticResource A_Style_TextBlock_CampaignSetupFlyer_Heading_Base}"
                                           TextTrimming="CharacterEllipsis"
                                           TextWrapping="NoWrap"
                                           CapHeight="22"/>

                        <local:FZTextBlock Style="{StaticResource A_Style_TextBlock_CampaignSetupFlyer_Description}"
                                           Margin="0,8,0,0"
                                           Text="{local:Loc EventBlueprint.IDS_Flyer_CreatorPresents}" />
                    </StackPanel>
                </Grid>

                <FrameworkElement local:ScreenReader.Event="OnChange"
                                  local:ScreenReader.ControlType="Button"
                                  local:ScreenReader.LineType="SelectedItem">
                    <FrameworkElement.Style>
                        <Style TargetType="{Type FrameworkElement}">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}" Value="True">
                                    <Setter Property="local:ScreenReader.Line" Value="{Binding Title, Converter={StaticResource A_Converter_NewlinesToVoicedLineSeparator_Space}}"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </FrameworkElement.Style>
                </FrameworkElement>

                <StackPanel VerticalAlignment="Bottom">
                    <Decorator Height="77.5" VerticalAlignment="Bottom" Margin="0,0,0,5">
                        <local:FZTextBlock VerticalAlignment="Top"
                                           MaxWidth="350"
                                           Style="{StaticResource A_Style_TextBlock_CampaignSetupFlyer_Heading_Base}"
                                           Text="{Binding Title, Converter={StaticResource A_StringToUpper}}"/>
                    </Decorator>
                    <ItemsControl ItemsSource="{Binding RaceModes}"
                                  AlternationCount="2"
                                  DockPanel.Dock="Bottom">
                        <ItemsControl.Template>
                            <ControlTemplate TargetType="{Type ItemsControl}">
                                <Grid>
                                    <Decorator VerticalAlignment="Top" Height="0">
                                        <FZMaterial ImageSource="game:\Media\UI\Textures\Data_Bound\PDLC2\Event_Blueprint\Shadow.png"
                                                    VerticalAlignment="Bottom"
                                                    GetSizeFromTexture="True"/>
                                    </Decorator>
                                    <ItemsPresenter/>
                                </Grid>
                            </ControlTemplate>
                        </ItemsControl.Template>
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <UniformGrid IsItemsHost="True" Rows="1"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemContainerStyle>
                            <Style TargetType="{Type ContentPresenter}"/>
                        </ItemsControl.ItemContainerStyle>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <FZMaterial Visibility="{Binding Downloaded, RelativeSource={RelativeSource Self}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                                                Height="90.5"
                                                Margin="{Binding (ItemsControl.AlternationIndex), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource A_Converter_AltenationIndexToOverlapMargin}}">
                                        <FZMaterial.Style>
                                            <Style TargetType="{Type FZMaterial}">
                                                <Setter Property="ImageSource" Value="{Binding RaceMode, Converter={StaticResource A_Converter_RaceModeToFooterIncompleteImagePath}}"/>
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding State}" Value="{Static XAMLCampaignRaceModeOptionState.Complete}">
                                                        <Setter Property="ImageSource" Value="{Binding RaceMode, Converter={StaticResource A_Converter_RaceModeToFooterCompleteImagePath}}"/>
                                                    </DataTrigger>
                                                    <DataTrigger Binding="{Binding State}" Value="{Static XAMLCampaignRaceModeOptionState.Locked}">
                                                        <Setter Property="ImageSource" Value="{Binding RaceMode, Converter={StaticResource A_Converter_RaceModeToFooterLockedImagePath}}"/>
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </FZMaterial.Style>
                                    </FZMaterial>
                                    <Decorator Width="0" HorizontalAlignment="Left">
                                        <FZMaterial ImageSource="game:\Media\UI\Textures\Data_Bound\PDLC2\Event_Blueprint\Divider.png"
                                                    GetSizeFromTexture="True"
                                                    HorizontalAlignment="Center"
                                                    Visibility="{Binding RelativeSource={RelativeSource PreviousData}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"/>
                                    </Decorator>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </StackPanel>
            </Grid>
        </DataTemplate>
    
        <DataTemplate DataType="{x:Type local:CampaignEventSelectRoute}">
            <Grid Style="{StaticResource A_Style_FrameworkElement_DefaultTransition}"
                  Width="{StaticResource A_Double_Carousel_Tile_Width}"
                  Height="{StaticResource A_Double_Carousel_Tile_Height}"
                  local:UIPageTransitionManager.TransitionIndex="{Binding (local:UIPageTransitionManager.TransitionIndex), RelativeSource={RelativeSource TemplatedParent}}">
                <ContentControl Style="{StaticResource A_Style_ContentControl_CampaignFlyerFront}" 
                                ContentTemplateSelector="{StaticResource A_EventSelect_FlyerTemplateSelector}"
                                DataContext="{Binding CampaignSetupItem}" />

                <FrameworkElement local:ScreenReader.Event="OnChange"
                                  local:ScreenReader.ControlType="Button"
                                  local:ScreenReader.LineType="SelectedItem">
                    <FrameworkElement.Style>
                        <Style TargetType="{Type FrameworkElement}">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}" Value="True">
                                    <Setter Property="local:ScreenReader.Line" Value="{Binding CampaignSetupItem.Name}"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </FrameworkElement.Style>
                </FrameworkElement>
            </Grid>
        </DataTemplate>

        <Style x:Key="A_Style_ContentControl_Carousel_ContainerStyle_CampaignEventSelect"
               BasedOn="{StaticResource H_Style_ContentControl_Carousel_ContainerStyle}"
               TargetType="ContentControl">
            <Setter Property="Margin" Value="0,0,4,4"/>
            <Setter
            Property="Template">
                <Setter.Value>
                    <ControlTemplate
                    TargetType="{Type ContentControl}">
                        <ControlTemplate.Resources>
                            <ResourceDictionary>
                                <Storyboard
                                x:Key="SelectItemStory">
                                    <Int32AnimationUsingKeyFrames
                                    Storyboard.TargetProperty="(ZPanel.ClippingBias)">
                                        <DiscreteInt32KeyFrame
                                        KeyTime="0:0:0.0"
                                        Value="1" />
                                    </Int32AnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetProperty="(UIElement.Opacity)"
                                    Storyboard.TargetName="DropShadow">
                                        <DiscreteDoubleKeyFrame
                                        KeyTime="0:0:0.0"
                                        Value="0.6" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetProperty="(ScaleTransform.ScaleX)"
                                    Storyboard.TargetName="ShadowScale">
                                        <DiscreteDoubleKeyFrame
                                        KeyTime="0:0:0.0"
                                        Value="1.1" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetProperty="(ScaleTransform.ScaleY)"
                                    Storyboard.TargetName="ShadowScale">
                                        <DiscreteDoubleKeyFrame
                                        KeyTime="0:0:0.0"
                                        Value="1.1" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <Int32AnimationUsingKeyFrames
                                    Storyboard.TargetProperty="(Panel.ZIndex)"
                                    Storyboard.Target="{Binding RelativeSource={RelativeSource AncestorType=ContentPresenter}}">
                                        <DiscreteInt32KeyFrame
                                        KeyTime="0:0:0.0"
                                        Value="20" />
                                    </Int32AnimationUsingKeyFrames>
                                </Storyboard>
                                <UIStoryboard
                                x:Key="DeselectItemStory"
                                Duration="0:0:0.36">
                                    <Int32AnimationUsingKeyFrames
                                    Storyboard.TargetProperty="(ZPanel.ClippingBias)">
                                        <DiscreteInt32KeyFrame
                                        KeyTime="0:0:0.0"
                                        Value="1" />
                                        <DiscreteInt32KeyFrame
                                        KeyTime="0:0:0.3"
                                        Value="{x:Static Int32.MaxValue}" />
                                    </Int32AnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetProperty="(UIElement.Opacity)"
                                    Storyboard.TargetName="DropShadow">
                                        <EasingDoubleKeyFrame
                                        KeyTime="0:0:0.3"
                                        Value="0"
                                        EasingFunction="{CircleEasing}" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetProperty="(ScaleTransform.ScaleX)"
                                    Storyboard.TargetName="ShadowScale">
                                        <EasingDoubleKeyFrame
                                        KeyTime="0:0:0.3"
                                        Value="0.75"
                                        EasingFunction="{CircleEasing}" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetProperty="(ScaleTransform.ScaleY)"
                                    Storyboard.TargetName="ShadowScale">
                                        <EasingDoubleKeyFrame
                                        KeyTime="0:0:0.3"
                                        Value="0.75"
                                        EasingFunction="{CircleEasing}" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <Int32AnimationUsingKeyFrames
                                    Storyboard.TargetProperty="(Panel.ZIndex)"
                                    Storyboard.Target="{Binding RelativeSource={RelativeSource AncestorType=ContentPresenter}}">
                                        <EasingInt32KeyFrame
                                        KeyTime="0:0:0.3"
                                        Value="0"
                                        EasingFunction="{CircleEasing}" />
                                    </Int32AnimationUsingKeyFrames>
                                </UIStoryboard>
                                <Storyboard
                                x:Key="PART_TransitionOut" />
                            </ResourceDictionary>
                        </ControlTemplate.Resources>
                        <Grid
                        x:Name="OuterContainer">
                            <Grid.Style>
                                <Style TargetType="Grid">
                                    <Style.Triggers>
                                        <MultiDataTrigger>
                                            <MultiDataTrigger.Conditions>
                                                <Condition Binding="{Binding EventInfoDataView.Show, RelativeSource={RelativeSource AncestorType=Page}}" Value="{StaticResource A_Boolean_True}"/>
                                                <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="{StaticResource A_Boolean_False}"/>
                                            </MultiDataTrigger.Conditions>
                                            <Setter Property="Opacity" Value="0.4"/>
                                        </MultiDataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Grid.Style>
                            <FZMaterial
                            x:Name="DropShadow"
                            Style="{DynamicDataBinding DropShadowStyle, FallbackValue={StaticResource H_Style_FZMaterial_ShadowBase_ForSubgraph}}">
                                <FZMaterial.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform
                                        ScaleX="0"
                                        ScaleY="0"
                                        x:Name="ShadowScale" />
                                    </TransformGroup>
                                </FZMaterial.RenderTransform>
                            </FZMaterial>
                            <Grid
                            x:Name="ScaledContainer"
                            RenderTransformOrigin="0.5,0.5"
                            ZPanel.ZOffset="0"
                            Style="{DynamicDataBinding ScaledContainerStyle, FallbackValue={StaticResource H_Style_FrameworkElement_CarouselSelectionScale}}">
                                <StrokeHighlightControl
                                x:Name="FocusHighlight"
                                Style="{StaticResource H_Style_StrokeHighlight_Animated}"
                                IsEnabled="{Binding (Selector.IsSelected), FallbackValue=False, RelativeSource={RelativeSource TemplatedParent}}" />
                                <ContentControl Style="{DynamicDataBinding ItemBackgroundContainerControlStyle, FallbackValue={StaticResource H_Style_ContentControl_ContainerBackground}}">
                                    <ContentPresenter />
                                </ContentControl>
                                <Control
                                x:Name="MouseRollover"
                                Style="{DynamicDataBinding MouseRolloverStyle, FallbackValue={StaticResource H_Style_TemplatedElement_MouseRollover_ListBoxItem}}" />
                            </Grid>
                            <Decorator RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Center"
                                       Visibility="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                                <Decorator.RenderTransform>
                                    <TranslateTransform X="388"/>
                                </Decorator.RenderTransform>
                                <Grid Visibility="{Binding EventInfoDataView.Show, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter}, FallbackValue=Collapsed}">
                                    <Control Style="{StaticResource A_Style_Event_RaceInfo_FlyerPopup}"
                                             DataContext="{Binding EventInfoDataView, RelativeSource={RelativeSource AncestorType=Page}}"/>
                                </Grid>
                            </Decorator>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger
                            Property="Selector.IsSelected"
                            Value="True">
                                <Trigger.EnterActions>
                                    <BeginStoryboard
                                    x:Name="ShowSelected_BeginStoryboard2"
                                    HandoffBehavior="SnapshotAndReplace"
                                    Storyboard="{StaticResource SelectItemStory}" />
                                </Trigger.EnterActions>
                                <Trigger.ExitActions>
                                    <BeginStoryboard
                                    x:Name="HideSelected_BeginStoryboard2"
                                    HandoffBehavior="SnapshotAndReplace"
                                    Storyboard="{StaticResource DeselectItemStory}" />
                                </Trigger.ExitActions>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style TargetType="local:CommonListBox"
               x:Key="A_Style_Carousel_CampaignEventSelect">
            <Setter Property="AlternationCount"
                    Value="10000" />
            <Setter Property="ItemContainerStyle"
                    Value="{StaticResource A_Style_ContentControl_Carousel_ContainerStyle_CampaignEventSelect}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBox">
                        <WrapPanel IsItemsHost="True"
                            KeyboardNavigation.DirectionalNavigation="Contained"
                            Orientation="Vertical"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Storyboard x:Key="A_Storyboard_SmoothScrollWithMotionBlur" >
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(local:BlendValue.Blend)"
                                           Storyboard.TargetName="{x:Null}"
                                           FillBehavior="Stop">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                        Value="0" />
                <EasingDoubleKeyFrame KeyTime="0:0:0.267"
                                      Value="1"
                                      EasingFunction="{local:QuarticEasing EasingMode=EaseOut}" />
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

        <local:MappingConverter x:Key="A_Converter_EventInfo_Toggle_Bool_To_String">
            <local:MappingConverterEntry Key="False" Value="{local:Loc HelpButtons.IDS_ViewEventInformation}"/>
            <local:MappingConverterEntry Key="True" Value="{local:Loc HelpButtons.IDS_HideEventInformation}"/>
        </local:MappingConverter>
    </Page.Resources>


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


        <PageInputHandler
            Button="RTrigger" 
            x:Name="get_share_code_input">
            <PageInputHandler.Style>
                <Style TargetType="PageInputHandler">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding EventInfoDataView.Show}" Value="True">
                            <Setter Property="Command" Value="{Binding EventInfoDataView.GetShareCodeCommand}"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </PageInputHandler.Style>
        </PageInputHandler>
        <PageInputHandler 
            x:Name="MoreInfoButtonInput"
            Command="{Binding ToggleEventInfoCommand}"
            Button="R3" />
        <local:PlayerBarControl x:Name="TopBar" Style="{StaticResource A_Style_PlayerBarControl}" />
        <ContentControl x:Name="BottomBar" Style="{StaticResource A_Style_ButtonBar}">
            <local:ControllerButtonPanel x:Name="PART_HelpPanel"
                                        Style="{StaticResource A_Style_ControllerButtonPanel_Default}"
                                        local:ScreenReader.InterruptBehavior="WaitForNonePlaying">
                <local:ControllerButtonControl Button="A"
                                            Description="{local:Loc HelpButtons.IDS_Select}" />
                <local:ControllerButtonControl Button="B"
                                            Description="{local:Loc HelpButtons.IDS_Back}" />
                <local:ControllerButtonControl
                                            Button="{Binding Button, ElementName=MoreInfoButtonInput}"
                                            Description="{Binding EventInfoDataView.Show, Converter={StaticResource A_Converter_EventInfo_Toggle_Bool_To_String}}"
                                            Visibility="{Binding Command.Enabled, Converter={StaticResource A_FZBooleanToVisibilityConverter}, ElementName=MoreInfoButtonInput, FallbackValue=Collapsed}" />
            </local:ControllerButtonPanel>
        </ContentControl>

        <Border Style="{StaticResource A_Style_Border_ScenePadding}">
            <Grid x:Name="PART_LayoutRoot" KeyboardNavigation.DirectionalNavigation="Contained">
                <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Width="1682">
                    <Decorator Margin="0,0" Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                        <ContentControl Content="{Binding ScreenTitle, Converter={StaticResource A_StringToUpper}}" 
                                        Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                        HorizontalAlignment="Left"
                                        local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/PlayerCreatedRoutes.png"/>
                    </Decorator>

                    <Grid Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_1}">
                        <StackPanel>
                            <FZButtonsSelector
                                x:Name="TabBar"
                                Style="{StaticResource H_Style_TabBar_Scrolling}"
                                ItemsSource="{Binding Groups}"
                                SelectedItem="{Binding SelectedGroup, Mode=TwoWay}"
                                Width="1682">
                                <FZButtonsSelector.ItemContainerStyle>
                                    <Style
                                        TargetType="FZButton"
                                        BasedOn="{StaticResource H_Style_TabButton_Scrolling}">
                                        <Setter
                                            Property="Content"
                                            Value="{Binding Text, Converter={StringToUpper}}" />
                                    </Style>
                                </FZButtonsSelector.ItemContainerStyle>
                                <FZButtonsSelector.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <VirtualizingScrollPanel
                                            Style="{StaticResource H_Style_MotionBlurScrollPanel_TabBar}"
                                            ItemWidth="507"
                                            Padding="507,0,0,0"/>
                                    </ItemsPanelTemplate>
                                </FZButtonsSelector.ItemsPanel>
                            </FZButtonsSelector>
                            <PageInputHandler Command="{Binding ScrollPagePrevCommand, ElementName=TabBar}"
                                              Button="LBumper" />
                            <PageInputHandler Command="{Binding ScrollPageNextCommand, ElementName=TabBar}"
                                              Button="RBumper" />
                            <Grid>
                                <Grid
                                    local:BlendValue.SkipInitialInputChanges="1"
                                    local:BlendValue.Input="{Binding (local:FindVisualOffset.VisualOffset).X, ElementName=PART_ItemListBox, Converter={Clamp Min=313}}"
                                    local:BlendValue.InputChangedStoryboard="{StaticResource A_Storyboard_SmoothScrollWithMotionBlur}">
                                    <Grid.RenderTransform>
                                        <TranslateTransform X="{Binding (local:BlendValue.Output), RelativeSource={RelativeSource AncestorType=Grid}, Converter={LinearTransformConverter Scale=-1, Add=313}}" />
                                    </Grid.RenderTransform>
                                    <StackPanel Orientation="Horizontal" Grid.Row="1" x:Name="content">
                                        <local:CommonListBox x:Name="PART_ItemListBox"
                                                             Style="{StaticResource A_Style_Carousel_CampaignEventSelect}"
                                                             local:FindVisualOffset.SelectedItem="{Binding SelectedItem, RelativeSource={RelativeSource Self}}"
                                                             ItemsSource="{Binding Collection}"
                                                             Height="{Convert {StaticResource A_Double_Carousel_Tile_Height_with_margin}}"
                                                             local:FocusOnPageFocusGained.SelectorSelectedItem="True"
                                                             SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                                                             PageSize="1"/>
                                        <StackPanel x:Name="empties" 
                                            Orientation="Horizontal"
                                            Panel.ZIndex="-10">
                                            <Control Style="{StaticResource H_Style_Control_Carousel_EmptyItemStyle}"
                                                Width="{StaticResource A_Double_Carousel_Tile_Width}"
                                                Height="{StaticResource A_Double_Carousel_Tile_Height}" />
                                            <Control Style="{StaticResource H_Style_Control_Carousel_EmptyItemStyle}"
                                                Width="{StaticResource A_Double_Carousel_Tile_Width}"
                                                Height="{StaticResource A_Double_Carousel_Tile_Height}" />
                                            <Control Style="{StaticResource H_Style_Control_Carousel_EmptyItemStyle}"
                                                Width="{StaticResource A_Double_Carousel_Tile_Width}"
                                                Height="{StaticResource A_Double_Carousel_Tile_Height}" />
                                            <Control Style="{StaticResource H_Style_Control_Carousel_EmptyItemStyle}"
                                                Width="{StaticResource A_Double_Carousel_Tile_Width}"
                                                Height="{StaticResource A_Double_Carousel_Tile_Height}" />
                                        </StackPanel>
                                    </StackPanel>
                                </Grid>
                                <local:NavigationArrows Style="{StaticResource A_Style_Control_NavigationArrows}"
                                                        Margin="-40,0,-20,0"
                                                        CanSelectPrev="{Binding CanSelectPrev, ElementName=PART_ItemListBox}"
                                                        CanSelectNext="{Binding CanSelectNext, ElementName=PART_ItemListBox}"
                                                        ScrollPagePrevCommand="{Binding ScrollPagePrevCommand, ElementName=PART_ItemListBox}"
                                                        ScrollPageNextCommand="{Binding ScrollPageNextCommand, ElementName=PART_ItemListBox}"/>
                            </Grid>
                        </StackPanel>
                    </Grid>
                </StackPanel>
            </Grid>
        </Border>

    </Grid>
</Page>
