<Page 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"
      xmlns:local="clr-namespace:ForzaUI"
      x:Class="ForzaUI.A_CarLoadingLayout1"
      mc:Ignorable="d"
      VerticalAlignment="Center"
      HorizontalAlignment="Center"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">
    <Page.Resources>
        <!-- These resources (max & min stat title scales, min & max char counts) are referred to by name directly in code -->
        <System:Double x:Key="A_FontSize_MaximumStatTitleScale">2.25</System:Double>
        <System:Double x:Key="A_FontSize_MinimumStatTitleScale">1.0</System:Double>
        <System:Int32 x:Key="A_Count_CharactersAtMinimumScale">9</System:Int32>
        <System:Int32 x:Key="A_Count_CharactersAtMaximumScale">22</System:Int32>
    </Page.Resources>

    <Grid>
        <StackPanel>
            <Viewbox>
                <ContentControl x:Name="TitleControl"
                                Template="{StaticResource A_Template_CLC_SingleLineTitle}"
                                Margin="0,0,-6,0"/>
            </Viewbox>

            <Grid>
                <ContentControl x:Name="UnderlineControl"
                                Margin="0,-15,0,0"
                                Template="{StaticResource A_Template_CLC_TitleUnderline}" />
            </Grid>

            <Viewbox>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <ContentControl x:Name="Stat0Control"
                                    Style="{StaticResource A_Style_CLC_AnimatedControl}"
                                    Content="{StaticResource A_Template_CLC_Stat_Left}"
                                    Grid.Column="0"
                                    DataContext="{Binding PlayerStats[0]}"/>
                    <ContentControl x:Name="Stat1Control"
                                    Style="{StaticResource A_Style_CLC_AnimatedControl}"
                                    Content="{StaticResource A_Template_CLC_Stat_Left}"
                                    Grid.Column="1"
                                    DataContext="{Binding PlayerStats[1]}"
                                    HorizontalAlignment="Center"
                                    Margin="150,0,150,0"/>
                    <ContentControl x:Name="Stat2Control"
                                    Style="{StaticResource A_Style_CLC_AnimatedControl}"
                                    Content="{StaticResource A_Template_CLC_Stat_Left}"
                                    Grid.Column="2"
                                    DataContext="{Binding PlayerStats[2]}"/>
                </Grid>
            </Viewbox>
        </StackPanel>

        <local:EventFire x:Name="TitleEventFire" TargetName="TitleControl" />
        <local:EventFire x:Name="UnderlineEventFire" TargetName="UnderlineControl" />
        <local:EventFire x:Name="Stat0ControlEventFire" TargetName="Stat0Control" />
        <local:EventFire x:Name="Stat1ControlEventFire" TargetName="Stat1Control" />
        <local:EventFire x:Name="Stat2ControlEventFire" TargetName="Stat2Control" />

        <!-- Audio Events -->
        <local:AudioEvent x:Name="TitleAudioEvent" />
        <local:AudioEvent x:Name="Stat0AudioEvent" />
        <local:AudioEvent x:Name="Stat1AudioEvent" />
        <local:AudioEvent x:Name="Stat2AudioEvent" />
    </Grid>
</Page>
