<navigation:Page x:Class="FileBrowser.FileBrowserPage" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
           Title="File Browser Sample"
           x:Name="MyFileBrowserPage">
    <navigation:Page.Resources>
        <DataTemplate x:Key="ThumbnailTemplate">
            <Border BorderThickness="0" BorderBrush="Silver">

                <StackPanel x:Name="ThumbnailPanel" Orientation="Vertical" Background="White" Width="220" Height="220"
                            Tag="{Binding DisplayName}"
                            MouseLeftButtonDown="ThumbnailPanel_MouseLeftButtonDown">
                    <Border BorderThickness="1" BorderBrush="Gainsboro"  Background="Gainsboro"
                            HorizontalAlignment="Center" VerticalAlignment="Center"
                            Width="200" Height="200">
                        <Border.Effect>
                            <DropShadowEffect/>
                        </Border.Effect>
                        <Image Source="{Binding ImageSource}" Stretch="Uniform"/>
                    </Border>
                    <TextBlock Text="{Binding DisplayName}"  TextTrimming="WordEllipsis" TextAlignment="Center"
                               Margin="0,5,0,0"/>
            </StackPanel>
            </Border>
        </DataTemplate>
    </navigation:Page.Resources>
    <Grid x:Name="LayoutRoot">
        <ListBox ItemTemplate="{StaticResource ThumbnailTemplate}"
                 ItemsSource="{Binding ThumbnailCollection}"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <toolkit:WrapPanel/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>
    </Grid>
</navigation:Page>
