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

    <Page.Resources>
        <ResourceDictionary>
            
            <Color x:Key="A_Color_Text">#FFFFFF</Color>

            <local:MotionBlurEffect x:Key="A_MotionBlurEffect_TeamCredits" MotionBlurMinThreshold="1" />

            <!--The preset for small rounded corners for a material. Used in creating the linethrough effect-->
            <CornerRadius x:Key="A_SmallCornerRadius_Outer_All">3</CornerRadius>
            <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll_Small"
                BasedOn="{StaticResource A_FZMaterialPreset_FlatPanel_Base}"
                CornerRadius="{StaticResource A_SmallCornerRadius_Outer_All}"/>

            <Style x:Key="A_Style_FZTextBlock_Credits_Major" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="TextAlignment" Value="Center" />
                <Setter Property="CapHeight" Value="24"/>
                <Setter Property="Color" Value="{StaticResource A_Color_Text}" />
                <Setter Property="TextWrapping" Value="Wrap"/>
                <Setter Property="TrackingAdjust" Value="0.08"/>
                <Setter Property="RenderTransform">
                    <Setter.Value>
                        <TransformGroup>
                            <SkewTransform AngleX="-7.8" />
                            <TranslateTransform X="3.2"/>
                        </TransformGroup>
                    </Setter.Value>
                </Setter>

            </Style>

            <Style x:Key="A_Style_FZTextBlock_Credits_Sub" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_Credits_Major}">
                <Setter Property="CapHeight" Value="16"/>
                <Setter Property="Margin" Value="0"/>
            </Style>

            <Style x:Key="A_Style_FZTextBlock_Credits_Title" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}">
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="TextAlignment" Value="Center" />
                <Setter Property="CapHeight" Value="16"/>
                <Setter Property="Effect" Value="{StaticResource A_DropShadowEffect_DefaultHud}" />
                <Setter Property="Color" Value="{StaticResource A_Color_Text}" />
                <Setter Property="TextWrapping" Value="Wrap"/>
            </Style>

            <Style x:Key="A_Style_FZTextBlock_Credits_Name" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="TextAlignment" Value="Center" />
                <Setter Property="CapHeight" Value="16"/>
                <Setter Property="LineStackingStrategy" Value="BlockLineHeight"/>
                <Setter Property="LineHeight" Value="26"/>
                <Setter Property="Margin" Value="0,8,0,0"/>
                <Setter Property="Effect" Value="{StaticResource A_DropShadowEffect_DefaultHud}" />
                <Setter Property="Color" Value="{StaticResource A_Color_Text}" />
                <Setter Property="TextWrapping" Value="Wrap"/>
            </Style>
          
            <Style x:Key="A_Style_CreditsList" TargetType="ItemsControl">
                <Setter Property="ItemTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <StackPanel x:Name="Container" HorizontalAlignment="Center" Margin="450, 0, 450, 50">
                                <local:FZTextBlock x:Name="Title" Text="{Binding Name}" Style="{StaticResource A_Style_FZTextBlock_Credits_Title}"/>
                                <local:FZTextBlock Text="{Binding EntriesString, Converter={StaticResource A_StringToUpper}}" Style="{StaticResource A_Style_FZTextBlock_Credits_Name}" />
                                <local:FZMaterial x:Name="BottomBar" Height="3" Visibility="Collapsed" Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll_Small}"/>
                            </StackPanel>
                            <DataTemplate.Triggers>
                              <DataTrigger Binding="{Binding Style}" Value="major">
                                    <Setter TargetName="Title"
                                        Property="Style"
                                        Value="{StaticResource A_Style_FZTextBlock_Credits_Major}"/>
                                    <Setter TargetName="BottomBar"
                                        Property="Visibility"
                                        Value="Visible"/>
                              </DataTrigger>
                              <DataTrigger Binding="{Binding Style}" Value="sub">
                                    <Setter TargetName="Title"
                                            Property="Style"
                                            Value="{StaticResource A_Style_FZTextBlock_Credits_Sub}"/>
                                    <Setter TargetName="BottomBar"
                                            Property="Visibility"
                                            Value="Visible"/>
                                    <Setter TargetName="Container"
                                            Property="Margin"
                                            Value="0, 17, 0, 48"/>
                                </DataTrigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>
                        
                    </Setter.Value>
                </Setter>           
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel />
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Grid Effect="{StaticResource A_MotionBlurEffect_TeamCredits}" 
                                  local:MotionBlurEffect.MotionBlurPositionYControl="{Binding (Control.RenderTransform).(TranslateTransform.Y), ElementName=CreditsStackPanel}" >
                                <ScrollViewer Focusable="False" 
                                              HorizontalScrollBarVisibility="Disabled" 
                                              VerticalScrollBarVisibility="Disabled">
                                    <VirtualizingStackPanel x:Name="CreditsStackPanel" Orientation="Vertical" IsItemsHost="True">
                                        <VirtualizingStackPanel.RenderTransform>
                                            <TranslateTransform Y="{TemplateBinding ActualHeight}"/>
                                        </VirtualizingStackPanel.RenderTransform>
                                    </VirtualizingStackPanel>
                                </ScrollViewer>
                                <local:FZMaterial 
                                    HorizontalAlignment="Stretch" 
                                    VerticalAlignment="Top" 
                                    Height="200" 
                                    Margin="-100">
                                    <local:FZMaterial.Preset>
                                        <local:FZMaterialPresetRoundtangle Softness="50" Unlit="True" AlphaMode="MultiplyInv"/>
                                    </local:FZMaterial.Preset>
                                </local:FZMaterial>
                                <local:FZMaterial 
                                    HorizontalAlignment="Stretch" 
                                    VerticalAlignment="Bottom" 
                                    Height="200" 
                                    Margin="-100">
                                    <local:FZMaterial.Preset>
                                        <local:FZMaterialPresetRoundtangle Softness="50" Unlit="True" AlphaMode="MultiplyInv"/>
                                    </local:FZMaterial.Preset>
                                </local:FZMaterial>                                    
                            </Grid>
                        </ControlTemplate> 
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </Page.Resources>
    
    <Grid>

        <local:FZMaterial Visibility="{Binding IsInPauseFlow, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" Color="Black"/>
        <local:FZMaterial Visibility="{Binding IsInPauseFlow, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}" Color="Black" Opacity="0.2"/>

        <ContentControl x:Name="BottomBar" Style="{StaticResource A_Style_ButtonBar}">
            <ContentControl x:Name="DefaultHelpPanel"
                            local:ControllerButtonPanel.BDescription="{local:Loc HelpButtons.IDS_Back}"
                            Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}" />
        </ContentControl>
        <Grid x:Name="LayoutRoot"
              Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}"
              IsHitTestVisible="False">
            <ItemsControl x:Name="CreditList" ItemsSource="{Binding Categories}" Style="{StaticResource A_Style_CreditsList}" VirtualizingStackPanel.IsVirtualizing="True"/>
        </Grid>
        <local:EventFire x:Name="EventFire" />
    </Grid>
</Page>
