<Page
    x:Class="DisplayHighSchoolStudents.StudentPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:DisplayHighSchoolStudents"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Name="page"
    FontSize="24">

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="140" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <Button Name="backButton"
                    Grid.Column="0"
                    Style="{StaticResource BackButtonStyle}"
                    IsEnabled="{Binding ElementName=page, Path=Frame.CanGoBack}"
                    Click="OnBackButtonClick" />

            <TextBlock Name="pageTitle"
                       Text="{Binding FullName}" 
                       Grid.Column="1" 
                       Style="{StaticResource PageHeaderTextStyle}" />
        </Grid>
        
        <StackPanel Grid.Row="1"
                    HorizontalAlignment="Center">
            <Image Source="{Binding PhotoFilename}"
                   Width="240" />
            
            <TextBlock Text="{Binding Sex}"
                       HorizontalAlignment="Center"
                       Margin="10" />

            <StackPanel Orientation="Horizontal"
                        HorizontalAlignment="Center"
                        Margin="10">
                <TextBlock Text="GPA =&#x00A0;" />
                <TextBlock Text="{Binding GradePointAverage}" />
            </StackPanel>
        </StackPanel>

        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="ApplicationViewStates">

                <VisualState x:Name="FullScreenLandscape" />

                <VisualState x:Name="Filled" />

                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton"
                                                       Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" 
                                                    Value="{StaticResource PortraitBackButtonStyle}" />
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton"
                                                       Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" 
                                                    Value="{StaticResource SnappedBackButtonStyle}" />
                        </ObjectAnimationUsingKeyFrames>

                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle"
                                                       Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" 
                                                    Value="{StaticResource SnappedPageHeaderTextStyle}" />
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</Page>