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

        <System:Int32 x:Key="A_TeamA">0</System:Int32>
        <System:Int32 x:Key="A_TeamB">1</System:Int32>

        <local:MappingConverter x:Key="A_Converter_Team_BackgroundColor" Default="{StaticResource H_Color_Primary_Pink}">
            <local:MappingConverterEntry Key="{StaticResource A_TeamA}" Value="{StaticResource A_Color_List_TeamA_Background}" />
            <local:MappingConverterEntry Key="{StaticResource A_TeamB}" Value="{StaticResource A_Color_List_TeamB_Background}" />
        </local:MappingConverter>

        <Style TargetType="FZMaterial" x:Key="H_Style_FZMaterial_Player_Outline">
            <Setter Property="Color" Value="{Binding WinningTeamID, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_Converter_Team_BackgroundColor}}" />
        </Style>

        <Style
            x:Key="A_Style_ItemsPanelStyle"
            TargetType="{Type UniformGrid}">
            <Setter Property="Columns" Value="3"/>
            <Setter Property="Rows" Value="2"/>
        </Style>


        <Style x:Key="H_Style_FZTextBlock_PostRaceUserProfile_Name"
           TargetType="local:FZTextBlock"
           BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
            <Setter Property="CapHeight" Value="20" />
            <Setter Property="Color" Value="{StaticResource H_Color_Primary_White}" />
        </Style>


        <UIPageTransition x:Key="A_UIPageTransition_PostRace_CustomIn"
            DurationSpread="{StaticResource A_Duration_Transition_Spread_PostRace_InOnly}"
            TransitionDelay="{StaticResource A_Duration_Transition_Delay_PostRace_InOnly}"
            AudioEvent="UI_PostRace_TeamPositionOn"/>

        <UIPageTransition x:Key="A_UIPageTransition_PostRace_CustomOut"
            DurationSpread="{StaticResource A_Duration_Transition_Spread}"
            TransitionDelay="{StaticResource A_Duration_Transition_Delay}"
            AudioEvent="UI_PostRace_TeamPositionOff"/>

    </PostRaceTeamFinish.Resources>
    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager>
            <local:UIPageTransitionManager.Preset>
                <local:UIPageTransitionManagerPreset
                    TransitionInForwards="{StaticResource A_UIPageTransition_PostRace_CustomIn}"
                    TransitionInBack="{StaticResource A_UIPageTransition_PostRace_CustomIn}"
                    TransitionOutForwards="{StaticResource A_UIPageTransition_PostRace_CustomOut}"
                    TransitionOutBack="{StaticResource A_UIPageTransition_PostRace_CustomOut}"/>
            </local:UIPageTransitionManager.Preset>
        </local:UIPageTransitionManager>
    </local:UIPageTransitionManager.TransitionManager>
    <Grid>

        <ContentControl x:Name="BottomBar" Style="{StaticResource A_Style_ButtonBar}">
            <ContentControl x:Name="PART_DefaultHelpPanel"
                    ControllerButtonPanel.ADescription="{Loc HelpButtons.IDS_Continue}"
                    Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}" />
        </ContentControl>

        <Decorator Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <StackPanel VerticalAlignment="Bottom"
                        Margin="0,0,0,135">
                <Decorator Style="{StaticResource A_Style_FrameworkElement_SlideLeftToRightTransition_0}"
                           Margin="102,0,0,0"  
                           Width="1492"
                           HorizontalAlignment="Left">
                    <Decorator Style="{StaticResource H_Style_PostRaceItalicise}">
                        <FZTextBlock Style="{StaticResource H_Style_PostRace_TitleText}"
                                     CapHeight="105"
                                     Text="{Binding WinningTeamString}">
                        </FZTextBlock>
                    </Decorator>
                </Decorator>

                     <Decorator  
                               Margin="146,23,0,0"  
                               HorizontalAlignment="Left"
                               VerticalAlignment="Center">
                        <ItemsControl ItemsSource="{Binding WinningTeamProfiles}"
                                      Width="1650"
                                      Height="136"
                                      HorizontalAlignment="Center">
                            <ItemsControl.Template>
                                <ControlTemplate TargetType="{Type ItemsControl}">
                                    <Grid>
                                    <Decorator Style="{StaticResource A_Style_FrameworkElement_SlideRightToLeftTransition_1}">
                                            <UniformGrid Style="{StaticResource A_Style_ItemsPanelStyle}" Opacity="0.4">
                                                <ContentControl ContentTemplate="{StaticResource H_DataTemplate_PostRaceUserProfile}" />
                                                <ContentControl ContentTemplate="{StaticResource H_DataTemplate_PostRaceUserProfile}" />
                                                <ContentControl ContentTemplate="{StaticResource H_DataTemplate_PostRaceUserProfile}"/>
                                                <ContentControl ContentTemplate="{StaticResource H_DataTemplate_PostRaceUserProfile}"/>
                                                <ContentControl ContentTemplate="{StaticResource H_DataTemplate_PostRaceUserProfile}"/>
                                                <ContentControl ContentTemplate="{StaticResource H_DataTemplate_PostRaceUserProfile}"/>
                                            </UniformGrid>
                                        </Decorator>
                                        <Decorator Style="{StaticResource A_Style_FrameworkElement_SlideRightToLeftTransition_1}">
                                            <ItemsPresenter/>
                                        </Decorator>
                                    </Grid>
                                </ControlTemplate>
                            </ItemsControl.Template>
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <UniformGrid Style="{StaticResource A_Style_ItemsPanelStyle}" />
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                             <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <ContentControl
                                       Content="{Binding DataContext, RelativeSource={RelativeSource TemplatedParent}}"
                                       ContentTemplate="{StaticResource H_DataTemplate_PostRaceUserProfile}"/> 
                                 </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </Decorator>
             </StackPanel>
        </Decorator>

    </Grid>
</PostRaceTeamFinish>
