<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:reader="using:Windows.Reader.Controls"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="Auto" Width="Auto">
	<UserControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.ThemeDictionaries>
				<ResourceDictionary x:Key="Default">
					<!-- Default theme resources -->
					<x:Double x:Key="GridViewItemBorderThickness">4</x:Double>
					<Thickness x:Key="ReaderPageBorderThickness">0</Thickness>
					<SolidColorBrush x:Key="ReaderCanvasBackground" Color="#FF1D1D1D"/>
					<SolidColorBrush x:Key="ReaderPageBorderBrush" Color="Transparent"/>
					<SolidColorBrush x:Key="ReaderGridViewAccentBrush" Color="#FFD24726"/>
					<SolidColorBrush x:Key="ReaderGridViewItemKeyboardFocusBrush" Color="#FFFFFFFF" />
					<SolidColorBrush x:Key="ReaderGridViewItemPointerOverBrush" Color="#4DFFFFFF" />
					<SolidColorBrush x:Key="ReaderGridViewItemSelectedPointerOverBorderBrush" Color="#FFD96246" />
					<SolidColorBrush x:Key="ReaderThumbnailBackground" Color="#4D4D4D4D"/>
					<SolidColorBrush x:Key="ReaderThumbnailForeground" Color="White"/>
					<SolidColorBrush x:Key="ReaderThumbnailBorderBrush" Color="Transparent"/>
				</ResourceDictionary>
				<ResourceDictionary x:Key="HighContrast">
					<!-- High Contrast theme resources -->
					<x:Double x:Key="GridViewItemBorderThickness">4</x:Double>
					<Thickness x:Key="ReaderPageBorderThickness">2</Thickness>
					<SolidColorBrush x:Key="ReaderCanvasBackground" Color="{StaticResource SystemColorWindowColor}"/>
					<SolidColorBrush x:Key="ReaderPageBorderBrush" Color="{StaticResource SystemColorWindowTextColor}"/>
					<SolidColorBrush x:Key="ReaderGridViewAccentBrush" Color="{StaticResource SystemColorHighlightColor}"/>
					<SolidColorBrush x:Key="ReaderGridViewItemKeyboardFocusBrush" Color="{StaticResource SystemColorButtonFaceColor}" />
					<SolidColorBrush x:Key="ReaderGridViewItemPointerOverBrush" Color="{StaticResource SystemColorHighlightColor}" />
					<SolidColorBrush x:Key="ReaderGridViewItemSelectedPointerOverBorderBrush" Color="{StaticResource SystemColorHighlightColor}" />
					<SolidColorBrush x:Key="ReaderInkStrokeBrush" Color="{StaticResource SystemColorButtonTextColor}"/>
					<SolidColorBrush x:Key="ReaderThumbnailBackground" Color="{StaticResource SystemColorWindowColor}"/>
					<SolidColorBrush x:Key="ReaderThumbnailForeground" Color="{StaticResource SystemColorWindowTextColor}"/>
					<SolidColorBrush x:Key="ReaderThumbnailBorderBrush" Color="{StaticResource SystemColorWindowTextColor}"/>
				</ResourceDictionary>
			</ResourceDictionary.ThemeDictionaries>
		</ResourceDictionary>
	</UserControl.Resources>
	<GridView ScrollViewer.IsHorizontalScrollChainingEnabled="False" ScrollViewer.IsVerticalScrollChainingEnabled="False" Background="{StaticResource ReaderCanvasBackground}" Height="Auto" HorizontalAlignment="Stretch" TabNavigation="Cycle" SelectionMode="Single" IsSwipeEnabled="false" Padding="0, 116, 0, 0" IsItemClickEnabled="True">
		<GridView.ItemTemplate>
			<DataTemplate>
				<StackPanel Orientation="Horizontal">
					<Border Height="Auto" Width="Auto" MinWidth="30" MinHeight="30" BorderThickness="{StaticResource ReaderPageBorderThickness}" BorderBrush="{StaticResource ReaderThumbnailBorderBrush}" Background="{StaticResource ReaderThumbnailBackground}" Margin="0, 0, 4, 0" VerticalAlignment="Top" FlowDirection="LeftToRight">
            <TextBlock x:Name='pageIndicatorText' Width="Auto" Height="Auto" Text="{Binding Name}" Foreground="{StaticResource ReaderThumbnailForeground}" Padding="5,4,5,4" HorizontalAlignment="Center" VerticalAlignment="Center"/>
          </Border>
					<reader:ReaderTwoPageItemsControl x:Name="GridViewItems" ItemsSource="{Binding PageItems}">
						<reader:ReaderTwoPageItemsControl.ItemTemplate>
							<DataTemplate x:Key="ReaderPageSeZoViewTemplate">
								<Grid Height="{Binding BoundingBoxHeight}" Width="{Binding BoundingBoxWidth}" Margin="0, 0, 1, 0">
									<Viewbox Height="{Binding ViewBoxHeight}" Width="{Binding ViewBoxWidth}" Stretch="Uniform" HorizontalAlignment="Left" VerticalAlignment="Top" FlowDirection="LeftToRight">
										<Canvas Height="{Binding RenderHeight}" Width="{Binding RenderWidth}" VerticalAlignment="Top" HorizontalAlignment="Left">
											<reader:PageViewControl x:Name="PageViewControl" Height="{Binding HeightKey}" Width="{Binding WidthKey}" State="{Binding DataState}" IsFlatRendering="True" IsSemanticZoom="True" Canvas.Left="0" Canvas.Top="0">
												<Canvas Width="{Binding Width, ElementName=PageViewControl}" Height="{Binding Height, ElementName=PageViewControl}" Background="Transparent">
													<Canvas Name="BlankContentCanvas" Width="{Binding Width, ElementName=PageViewControl}" Height="{Binding Height, ElementName=PageViewControl}" Background="White"/>
													<Canvas Name="ContentCanvas" Width="{Binding Width, ElementName=PageViewControl}" Height="{Binding Height, ElementName=PageViewControl}"/>
													<Canvas Name="MaskCanvas" Width="{Binding Width, ElementName=PageViewControl}" Height="{Binding Height, ElementName=PageViewControl}"/>
												</Canvas>
											</reader:PageViewControl>
										</Canvas>
									</Viewbox>
								</Grid>
							</DataTemplate>
						</reader:ReaderTwoPageItemsControl.ItemTemplate>
						<reader:ReaderTwoPageItemsControl.ItemsPanel>
							<ItemsPanelTemplate>
								<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" FlowDirection="{Binding PageSetFlowDirection}"/>
							</ItemsPanelTemplate>
						</reader:ReaderTwoPageItemsControl.ItemsPanel>
						<reader:ReaderTwoPageItemsControl.Resources>
							<DataTemplate x:Name="DummyPageItem">
								<Border Height="{Binding HeightKey}" Width="{Binding WidthKey}" Background="{StaticResource ReaderThumbnailBorderBrush}"/>
							</DataTemplate>
						</reader:ReaderTwoPageItemsControl.Resources>
					</reader:ReaderTwoPageItemsControl>
				</StackPanel>
			</DataTemplate>
		</GridView.ItemTemplate>
		<GridView.ItemContainerStyle>
			<Style x:Key="ReaderSeZoItemContainerStyle" TargetType="GridViewItem">
				<Setter Property="Margin" Value="0,0,37,37"/>
				<Setter Property="Template">
					<Setter.Value>
						<ControlTemplate TargetType="GridViewItem">
							<Border x:Name="OuterContainer">
								<VisualStateManager.VisualStateGroups>
									<VisualStateGroup x:Name="CommonStates">
										<VisualState x:Name="Normal"/>
										<VisualState x:Name="PointerOver">
											<Storyboard>
												<DoubleAnimation Storyboard.TargetName="PointerOverBorder"
																 Storyboard.TargetProperty="Opacity"
																 Duration="0"
																 To="1" />
												<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectionBackground"
																								Storyboard.TargetProperty="Fill">
													<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ReaderGridViewItemSelectedPointerOverBorderBrush}" />
												</ObjectAnimationUsingKeyFrames>
												<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectedBorder"
																								Storyboard.TargetProperty="Stroke">
													<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ReaderGridViewItemSelectedPointerOverBorderBrush}" />
												</ObjectAnimationUsingKeyFrames>
											</Storyboard>
										</VisualState>
										<VisualState x:Name="Pressed">
											<Storyboard>
												<PointerDownThemeAnimation TargetName="ContentContainer" />
											</Storyboard>
										</VisualState>
										<VisualState x:Name="Disabled"/>
									</VisualStateGroup>
									<VisualStateGroup x:Name="FocusStates">
										<VisualState x:Name="Focused"/>
										<VisualState x:Name="Unfocused"/>
										<VisualState x:Name="PointerFocused"/>
									</VisualStateGroup>
									<VisualStateGroup x:Name="SelectionStates">
										<VisualState x:Name="Selecting">
											<Storyboard>
												<DoubleAnimation Storyboard.TargetName="SelectionBackground"
																 Storyboard.TargetProperty="Opacity"
																 Duration="0"
																 To="1" />
												<DoubleAnimation Storyboard.TargetName="SelectedBorder"
																 Storyboard.TargetProperty="Opacity"
																 Duration="0"
																 To="1" />
											</Storyboard>
										</VisualState>
										<VisualState x:Name="Selected">
											<Storyboard>
												<DoubleAnimation Storyboard.TargetName="SelectionBackground"
																 Storyboard.TargetProperty="Opacity"
																 Duration="0"
																 To="1" />
												<DoubleAnimation Storyboard.TargetName="SelectedBorder"
																 Storyboard.TargetProperty="Opacity"
																 Duration="0"
																 To="1" />
											</Storyboard>
										</VisualState>
										<VisualState x:Name="Unselecting"/>
										<VisualState x:Name="Unselected"/>
										<VisualState x:Name="SelectedUnfocused">
											<Storyboard>
												<DoubleAnimation Storyboard.TargetName="SelectionBackground"
																 Storyboard.TargetProperty="Opacity"
																 Duration="0"
																 To="1" />
												<DoubleAnimation Storyboard.TargetName="SelectedBorder"
																 Storyboard.TargetProperty="Opacity"
																 Duration="0"
																 To="1" />
											</Storyboard>
										</VisualState>
									</VisualStateGroup>
								</VisualStateManager.VisualStateGroups>
								<Grid x:Name="ReorderHintContent" Background="Transparent">
									<Border x:Name="ContentContainer">
										<Grid x:Name="InnerDragContent">
											<Rectangle x:Name="PointerOverBorder"
													IsHitTestVisible="False"
													Opacity="0"
													Fill="{StaticResource ReaderGridViewItemPointerOverBrush}"
													Margin="36,1,1,1" />
											<Rectangle x:Name="FocusVisual"
													IsHitTestVisible="False"
													Opacity="0"
													StrokeThickness="2"
													Stroke="{StaticResource ReaderGridViewItemKeyboardFocusBrush}" />
											<Rectangle
													Margin="39,4,4,4"
													x:Name="SelectionBackground"
													Fill="{StaticResource ReaderGridViewAccentBrush}"
													Opacity="0" />
											<Border x:Name="ContentBorder"
													Background="{TemplateBinding Background}"
													BorderBrush="{TemplateBinding BorderBrush}"
													BorderThickness="{TemplateBinding BorderThickness}"
													Margin="4">
												<Grid>
													<ContentPresenter x:Name="contentPresenter"
															HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
															VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
															Margin="{TemplateBinding Padding}" />
													<Border Margin="35,0,0,0" BorderThickness="{StaticResource ReaderPageBorderThickness}" BorderBrush="{StaticResource ReaderPageBorderBrush}" IsHitTestVisible="False" />
													<Rectangle x:Name="SelectedBorder" IsHitTestVisible="False" Opacity="0" Margin="35,0,0,0" Stroke="{StaticResource ReaderGridViewAccentBrush}" StrokeThickness="{StaticResource GridViewItemBorderThickness}" />
												</Grid>
											</Border>
										</Grid>
									</Border>
								</Grid>
							</Border>
						</ControlTemplate>
					</Setter.Value>
				</Setter>
			</Style>
		</GridView.ItemContainerStyle>
		<GridView.Header>
			<Grid Width="81" />
		</GridView.Header>
		<GridView.ItemsPanel>
			<ItemsPanelTemplate>
				<WrapGrid Orientation="Vertical" />
			</ItemsPanelTemplate>
		</GridView.ItemsPanel>
	</GridView>
</UserControl>