tibility/2006"
    mc:Ignorable="d"
    d:ExtensionType="FileOpenPicker">

    <Page.Resources>
        <CollectionViewSource x:Name="filesViewSource" Source="{Binding Files}"/>
        <DataTemplate x:Key="StandardFileWithTooltip190x130ItemTemplate">
            <Grid>
                <Grid Background="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}">
                    <Image
                    Source="{Binding Image}"
                    Width="190"
                    Height="130"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Stretch="Uniform"/>
                </Grid>
                <ToolTipService.Placement>Mouse</ToolTipService.Placement>
                <ToolTipService.ToolTip>
                    <ToolTip>
                        <ToolTip.Style>
                            <Style TargetType="ToolTip">
                                <Setter Property="BorderBrush" Value="{ThemeResource ToolTipBackgroundThemeBrush}" />
                                <Setter Property="Padding" Value="0" />
                            </Style>
                        </ToolTip.Style>

                        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <Grid Background="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}" Margin="20">
                                <Image
                                Source="{Binding Image}"
                                Width="160"
                                Height="160"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Stretch="Uniform"/>
                            </Grid>
                            <StackPanel Width="200" Grid.Column="1" Margin="0,20,20,20">
                                <TextBlock Text="{Binding Title}" TextWrapping="NoWrap" Style="{StaticResource BodyTextBlockStyle}"/>
                                <TextBlock Text="{Binding Description}" MaxHeight="140" Foreground="{ThemeResource ApplicationSecondaryForegroundThemeBrush}" Style="{StaticResource BodyTextBlockStyle}"/>
                            </StackPanel>
                        </Grid>
                    </ToolTip>
                </ToolTipService.ToolTip>
            </Grid>
        </DataTemplate>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the command area
        * Row 1 contains the rest of the page layout
    -->
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition/>
            </TransitionCollection>
        </Grid.ChildrenTransitions>

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

        <!-- Horizontal scrolling grid of files fills the remainder -->
        <GridView
            x:Name="fileGridView"
            AutomationProperties.AutomationId="FileGridView"
            AutomationProperties.Name="Files"
            Grid.RowSpan="2"
            ItemsSource="{Binding Source={StaticResource filesViewSource}}"
            ItemTemplate="{StaticResource StandardFileWithTooltip190x130ItemTemplate}"
            SelectionMode="Multiple"
            SelectionChanged="FileGridView_SelectionChanged"
            Padding="116,76,116,20" />

        <!-- A vertical scrolling list is used when the window is less than 500 px wide -->
        <ListView
            x:Name="fileListView"
            AutomationProperties.AutomationId="fileListView"
            AutomationProperties.Name="Files"
            Grid.Row="2"
            ItemsSource="{Binding Source={StaticResource filesViewSource}}"
            ItemTemplate="{StaticResource StandardFileWithTooltip190x130ItemTemplate}"
            SelectionMode="Multiple"
            SelectionChanged="FileGridView_SelectionChanged"
            Margin="10,0,0,0"
            Padding="0,0,0,60"
            Visibility="Collapsed" />

        <!-- Command area -->
        <StackPanel x:Name="commandPanel" Orientation="Horizontal" Margin="120,20,120,30">
            <Button
                AutomationProperties.AutomationId="GoUpButton"
                AutomationProperties.Name="Go Up"
                Click="GoUpButton_Click"
                IsEnabled="{Binding CanGoUp}"
                Margin="-3,-3,35,0"
                Style="{StaticResource TextBlockButtonStyle}"
                Foreground="{ThemeResource ApplicationSecondaryForegroundThemeBrush}">
                <TextBlock Text="Go Up" Margin="3,-7,3,10" Style="{StaticResource SubheaderTextBlockStyle}" TextWrapping="NoWrap" />
            </Button>
        </StackPanel>

        <VisualStateManager.VisualStateGroups>
            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ViewStates">
                <VisualState x:Name="HorizontalView" />
                <!-- Switch to vertical scrolling when the window size is less than 500px-->
                <VisualState x:Name="VerticalView">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="fileGridView" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="fileListView" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="commandPanel" Storyboard.TargetProperty="Margin">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="20,20,20,30"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</Page>
