<Page
    x:Class="AppStudio.Views.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:AppStudio.Views"
    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 AppBackground}">
        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition/>
            </TransitionCollection>
        </Grid.ChildrenTransitions>

        <Hub x:Name="Container" DataContext="{Binding}" Header="{Binding NavigationHelper}" HeaderTemplate="{StaticResource MainPageHeader}" 
             SectionHeaderClick="OnSectionHeaderClick" SectionsInViewChanged="OnSectionsInViewChanged">
            <HubSection x:Name="TELEFONOSDEEMERGENCIASection" Header="TELÉFONOS DE EMERGENCIA" HeaderTemplate="{StaticResource HubSectionHeaderTemplate}" DataContext="{Binding MainViewModel.TELEFONOSDEEMERGENCIAModel}"
                        d:DataContext="{d:DesignData Source=/Assets/Data/TELEFONOSDEEMERGENCIADataSource.json, Type=vm:TELEFONOSDEEMERGENCIAViewModel, IsDesignTimeCreatable=true}"
                        ContentTemplate="{StaticResource TELEFONOSDEEMERGENCIAList}" IsHeaderInteractive="{Binding HasMoreItems}" Padding="120,12,0,30"
                        Style="{StaticResource HubSectionStyle}"/>
        </Hub>

        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup>
                <VisualState x:Name="SnappedView">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Container" Storyboard.TargetProperty="HeaderTemplate">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource MainPageHeaderSnapped}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TELEFONOSDEEMERGENCIASection" Storyboard.TargetProperty="ContentTemplate">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TELEFONOSDEEMERGENCIAListSnapped}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TELEFONOSDEEMERGENCIASection" Storyboard.TargetProperty="Padding">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="24,10,24,10"/>
                        </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="RefreshButton" Icon="Refresh" DataContext="{Binding MainViewModel}" Command="{Binding RefreshCommand}" Visibility="{Binding RefreshVisibility}"/>
        </CommandBar>
    </Page.BottomAppBar>
</Page>
