<Page
    x:Class="AppStudio.Views.LaJornadaDetail"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:AppStudio.Views"
    xmlns:controls="using:AppStudio.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vm="using:AppStudio.ViewModels"
    mc:Ignorable="d">

    <Grid Background="{StaticResource AppBackgroundColorBrush}">
        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition/>
            </TransitionCollection>
        </Grid.ChildrenTransitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <FlipView x:Name="Flip" Grid.RowSpan="2" AutomationProperties.AutomationId="ItemsFlipView" AutomationProperties.Name="Item Details" TabIndex="1"
                  DataContext="{Binding LaJornadaModel}"
                  d:DataContext="{d:DesignData Source=/Assets/Data/LaJornadaDataSource.json, Type=vm:LaJornadaViewModel, IsDesignTimeCreatable=true}"
                  ItemsSource="{Binding Items}"
                  SelectedItem="{Binding SelectedItem, Mode=TwoWay}">
            <FlipView.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="0">
                        <ContentPresenter ContentTemplate="{StaticResource LaJornada1DetailDetail}" />
                    </Grid>
                </DataTemplate>
            </FlipView.ItemTemplate>

        </FlipView>

        <!-- Back button and page title -->
        <ContentPresenter x:Name="HeaderHost" Grid.Row="0" ContentTemplate="{StaticResource PageHeaderSimple}" Content="{Binding NavigationHelper}" />

        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup>
                <VisualState x:Name="SnappedView">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderHost" Storyboard.TargetProperty="ContentTemplate">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PageHeaderSnapped}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Flip" Storyboard.TargetProperty="ItemTemplate">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <DataTemplate>
                                        <ScrollViewer HorizontalScrollBarVisibility="Disabled">
                                            <ContentPresenter ContentTemplate="{StaticResource LaJornada1DetailDetailSnapped}" />
                                        </ScrollViewer>
                                    </DataTemplate>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="PortraitView">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Flip" Storyboard.TargetProperty="ItemTemplate">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <DataTemplate>
                                        <ContentPresenter ContentTemplate="{StaticResource LaJornada1DetailDetailSnapped}" />
                                    </DataTemplate>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="FullscreenView">
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>

    <Page.BottomAppBar>
        <CommandBar Background="{StaticResource AppBarBackground}" BorderBrush="{StaticResource AppBarBackground}" Foreground="{StaticResource AppBarForeground}">
            <AppBarButton x:Uid="GoToSourceButton" Icon="Globe" DataContext="{Binding LaJornadaModel}" Command="{Binding GoToSourceCommand}" Visibility="{Binding GoToSourceVisibility}"/>
        </CommandBar>
    </Page.BottomAppBar>
</Page>
