GalleryWindow.xaml
<!-- Copyright 2012 ESRI All rights reserved under the copyright laws of the United States and applicable international laws, treaties, and conventions. You may freely redistribute and use this sample code, with or without modification, provided you include the original copyright notice and use restrictions. See the use restrictions. --> <Window x:Class="GlobeGallery.GalleryWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="WPF Globe Gallery" MaxHeight="Infinity" MaxWidth="Infinity" Height="350" Width="800" WindowStyle="SingleBorderWindow" Closing="Window_Closing" xmlns:er="clr-namespace:GlobeGallery" xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" Background="#FF757474" Foreground="#FFE5E0E0" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" > <!-- Styles and Templates --> <Window.Resources> <!-- Map Template --> <DataTemplate DataType="{x:Type er:Map}"> <Grid VerticalAlignment="Center" HorizontalAlignment="Center" Margin="6"> <!-- Drop Shadow --> <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="4" Background="#44000000"> <Border.RenderTransform> <TranslateTransform X="5" Y="5" /> </Border.RenderTransform> <Border.BitmapEffect> <BlurBitmapEffect Radius="8" /> </Border.BitmapEffect> </Border> <!-- Image Template --> <Border Padding="4" Background="White" BorderBrush="#22000000" BorderThickness="1"> <StackPanel Orientation="Vertical"> <Image Source="{Binding Path=Image.Thumbnail}"/> <Label Content="{Binding Path=MapName}" > <Label.ToolTip>Only JPeg images with a stored thumbnail will display a thumbnail during preview.</Label.ToolTip> </Label> </StackPanel> </Border> </Grid> </DataTemplate> <!-- map gallery view --> <Style TargetType="{x:Type ListBox}" x:Key="PhotoListBoxStyle"> <Setter Property="Foreground" Value="White" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBox}" > <WrapPanel Margin="5" IsItemsHost="True" Orientation="Horizontal" ItemHeight="{Binding Path=Value, ElementName=ZoomSlider}" ItemWidth="{Binding Path=Value, ElementName=ZoomSlider}" VerticalAlignment="Top" HorizontalAlignment="Stretch" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <!-- Style for an individual generic item --> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="Background" Value="Transparent" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}" > <Border SnapsToDevicePixels="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{TemplateBinding Background}"> <ContentPresenter /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Background" Value="#445B6249" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </Window.Resources> <!-- Master Container --> <Border x:Name="Border" CornerRadius="10,10,10,10" ScrollViewer.VerticalScrollBarVisibility="Auto" BorderThickness="5,5,5,5" Background="#FF000000"> <Grid DataContext="{Binding Source={StaticResource Maps}}" Height="Auto" Margin="10" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Grid Height="Auto" Margin="10" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Grid.RowDefinitions> <RowDefinition Height="50*" /> <RowDefinition Height="359.4*" /> </Grid.RowDefinitions> <ScrollViewer Grid.Row="1" BorderBrush="AliceBlue" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" ClipToBounds="False" BorderThickness="1" Height="Auto" Background="#FF000000"> <ListBox IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" Margin="5" MouseDoubleClick="OnMapClick" Name="MapsListBox" SelectedIndex="0" SelectionMode="Extended" Style="{StaticResource PhotoListBoxStyle}"></ListBox> </ScrollViewer> <DockPanel Height="36" VerticalAlignment="Top" Margin="0,0,0,0" HorizontalAlignment="Stretch"> <Slider Height="26" LargeChange="20" Maximum="320" Minimum="40" Name="ZoomSlider" Orientation="Horizontal" SmallChange="5" TickFrequency="40" TickPlacement="BottomRight" Value="120" Width="376" HorizontalAlignment="Center" VerticalAlignment="Top" /> </DockPanel> </Grid> </Grid> </Border> </Window>