Files
XplorePlane/XP.Common/PdfViewer/Views/PdfViewerWindow.xaml
T

76 lines
4.0 KiB
XML

<Window x:Class="XP.Common.PdfViewer.Views.PdfViewerWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:converters="clr-namespace:Telerik.Windows.Documents.Converters;assembly=Telerik.Windows.Controls.FixedDocumentViewers"
Title="{Binding Title}"
Width="1024" Height="768"
MinWidth="800" MinHeight="600"
WindowStartupLocation="CenterScreen"
ShowInTaskbar="True"
WindowStyle="SingleBorderWindow">
<Window.Resources>
<!-- 缩略图转换器:将 RadFixedDocument 转换为缩略图集合 | Thumbnail converter: converts RadFixedDocument to thumbnails collection -->
<converters:ThumbnailsConverter x:Key="ThumbnailsConverter" ThumbnailsHeight="200"/>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<!-- 工具栏(RadPdfViewerToolbar 内置导航/缩放/旋转/打印)| Toolbar (built-in navigation/zoom/rotate/print) -->
<RowDefinition Height="Auto"/>
<!-- PDF 显示区域 | PDF display area -->
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Telerik 内置工具栏 | Built-in toolbar -->
<telerik:RadPdfViewerToolBar Grid.Row="0"
telerik:StyleManager.Theme="Crystal"
RadPdfViewer="{Binding ElementName=pdfViewer, Mode=OneTime}"/>
<!-- 主内容区域:左侧缩略图面板 + 右侧 PDF 显示 | Main content: left thumbnails + right PDF display -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<!-- 左侧缩略图面板 | Left thumbnails panel -->
<ColumnDefinition Width="180"/>
<!-- PDF 显示区域 | PDF display area -->
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- 页面缩略图面板 | Page thumbnails panel -->
<Border Grid.Column="0" BorderBrush="#DDDDDD" BorderThickness="0,0,1,0" Background="#F5F5F5">
<ListBox x:Name="thumbnailListBox"
ItemsSource="{Binding ElementName=pdfViewer, Path=Document, Converter={StaticResource ThumbnailsConverter}}"
SelectionChanged="ThumbnailListBox_SelectionChanged"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
Background="Transparent"
BorderThickness="0"
Padding="4">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="2,4" HorizontalAlignment="Center">
<!-- 缩略图图片 | Thumbnail image -->
<Border BorderBrush="#CCCCCC" BorderThickness="1" Background="White"
HorizontalAlignment="Center">
<Image Source="{Binding ImageSource}" Stretch="Uniform"
MaxWidth="150" MaxHeight="200"/>
</Border>
<!-- 页码 | Page number -->
<TextBlock Text="{Binding PageNumber}"
HorizontalAlignment="Center" Margin="0,2,0,0"
FontSize="11" Foreground="#666666"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<!-- PDF 渲染区域 | PDF rendering area -->
<telerik:RadPdfViewer Grid.Column="1"
x:Name="pdfViewer"
telerik:StyleManager.Theme="Crystal"
DataContext="{Binding ElementName=pdfViewer, Path=CommandDescriptors}"/>
</Grid>
</Grid>
</Window>