MainWindow.xaml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <Window x:Class="PDFViewer.MainWindow"
  2. x:Name="Window"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  7. xmlns:cpdftools="clr-namespace:Compdfkit_Tools.PDFControl;assembly=Compdfkit_Tools"
  8. xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common;assembly=Compdfkit_Tools"
  9. mc:Ignorable="d"
  10. SnapsToDevicePixels="True"
  11. xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz"
  12. BorderThickness="{Binding RelativeSource={RelativeSource Mode=Self},Path=WindowState,Converter={StaticResource WindowStateToThicknessConverter}}"
  13. Title="ComPDFKit V1.9.1" Height="720" Width="1080" WindowStartupLocation="CenterScreen">
  14. <WindowChrome.WindowChrome>
  15. <WindowChrome
  16. CornerRadius="8"
  17. NonClientFrameEdges="Left,Bottom,Right"
  18. UseAeroCaptionButtons="False"
  19. ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}">
  20. <WindowChrome.CaptionHeight>
  21. <MultiBinding Converter="{StaticResource CaptionHeightConverter}">
  22. <Binding ElementName="TitleBarGrid" Path="ActualHeight"/>
  23. <Binding ElementName="Window" Path="BorderThickness.Top"/>
  24. </MultiBinding>
  25. </WindowChrome.CaptionHeight>
  26. </WindowChrome>
  27. </WindowChrome.WindowChrome>
  28. <Window.Resources>
  29. <ControlTemplate x:Key="CloseFileButton" TargetType="{x:Type ButtonBase}">
  30. <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
  31. BorderBrush="{TemplateBinding Border.BorderBrush}"
  32. Background="{TemplateBinding Panel.Background}"
  33. Name="border"
  34. SnapsToDevicePixels="True">
  35. <Path Name="content" VerticalAlignment="Center" HorizontalAlignment="Center" Fill="#666666">
  36. <Path.RenderTransform>
  37. <TransformGroup>
  38. <TranslateTransform X="8" Y="-8"/>
  39. <RotateTransform Angle="45"/>
  40. <TranslateTransform X="-4" Y="-5"/>
  41. </TransformGroup>
  42. </Path.RenderTransform>
  43. <Path.Data>
  44. M9.48528137,2.98528137 L9.48428137,8.48428137 L14.9852814,8.48528137 L14.9852814,9.48528137 L9.48428137,9.48428137 L9.48528137,14.9852814 L8.48528137,14.9852814
  45. L8.48428137,9.48428137 L2.98528137,9.48528137 L2.98528137,8.48528137 L8.48428137,8.48428137 L8.48528137,2.98528137 L9.48528137,2.98528137 Z
  46. </Path.Data>
  47. </Path>
  48. </Border>
  49. <ControlTemplate.Triggers>
  50. <Trigger Property="Button.IsDefaulted" Value="True">
  51. <Setter Property="Path.Fill" TargetName="content" Value="#666666" />
  52. </Trigger>
  53. <Trigger Property="UIElement.IsMouseOver" Value="True">
  54. <Setter Property="Path.Fill" TargetName="content" Value="#333333" />
  55. </Trigger>
  56. <Trigger Property="ButtonBase.IsPressed" Value="True">
  57. <Setter Property="Path.Fill" TargetName="content" Value="#000000" />
  58. </Trigger>
  59. </ControlTemplate.Triggers>
  60. </ControlTemplate>
  61. <ControlTemplate x:Key="AddFileButton" TargetType="{x:Type ButtonBase}">
  62. <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
  63. BorderBrush="{TemplateBinding Border.BorderBrush}"
  64. Background="{TemplateBinding Panel.Background}"
  65. Name="border"
  66. SnapsToDevicePixels="True">
  67. <Path Name="content" VerticalAlignment="Center" HorizontalAlignment="Center" Fill="#FFFFFF">
  68. <Path.RenderTransform>
  69. <TransformGroup>
  70. <TranslateTransform X="-2" Y="-2"/>
  71. </TransformGroup>
  72. </Path.RenderTransform>
  73. <Path.Data>
  74. M9.48528137,2.98528137 L9.48428137,8.48428137 L14.9852814,8.48528137 L14.9852814,9.48528137 L9.48428137,9.48428137 L9.48528137,14.9852814 L8.48528137,14.9852814
  75. L8.48428137,9.48428137 L2.98528137,9.48528137 L2.98528137,8.48528137 L8.48428137,8.48428137 L8.48528137,2.98528137 L9.48528137,2.98528137 Z
  76. </Path.Data>
  77. </Path>
  78. </Border>
  79. <ControlTemplate.Triggers>
  80. <Trigger Property="Button.IsDefaulted" Value="True">
  81. <Setter Property="Path.Fill" TargetName="content" Value="#666666" />
  82. </Trigger>
  83. <Trigger Property="UIElement.IsMouseOver" Value="True">
  84. <Setter Property="Path.Fill" TargetName="content" Value="#333333" />
  85. </Trigger>
  86. <Trigger Property="ButtonBase.IsPressed" Value="True">
  87. <Setter Property="Path.Fill" TargetName="content" Value="#000000" />
  88. </Trigger>
  89. </ControlTemplate.Triggers>
  90. </ControlTemplate>
  91. <Style x:Key="DragablzItemStyle" TargetType="{x:Type dragablz:DragablzItem}">
  92. <Setter Property="Template">
  93. <Setter.Value>
  94. <ControlTemplate TargetType="dragablz:DragablzItem">
  95. <Grid x:Name="templateRoot">
  96. <Grid.ColumnDefinitions>
  97. <ColumnDefinition Width="*" />
  98. <ColumnDefinition Width="auto" />
  99. </Grid.ColumnDefinitions>
  100. <Border x:Name="Title" Width="184" Height="32" Margin="10,4,0,0" BorderBrush="#A0A2AE" BorderThickness="1,1,1,0" CornerRadius="3,3,0,0">
  101. <Grid Background="Transparent">
  102. <Grid.ColumnDefinitions>
  103. <ColumnDefinition Width="auto" />
  104. <ColumnDefinition Width="*" MinWidth="10" />
  105. <ColumnDefinition Width="auto" />
  106. </Grid.ColumnDefinitions>
  107. <TextBlock x:Name="TextTitle" MaxWidth="145" Margin="8,4,0,4" FontFamily="Segoe UI,Microsoft YaHei" Text="{Binding FileName}" TextTrimming="WordEllipsis" />
  108. <Thumb x:Name="PART_Thumb" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalContentAlignment="Stretch" Background="Transparent" FontFamily="Segoe UI,Microsoft YaHei" ToolTip="{Binding FileName}">
  109. <Thumb.Template>
  110. <ControlTemplate>
  111. <Grid Background="Transparent" />
  112. </ControlTemplate>
  113. </Thumb.Template>
  114. </Thumb>
  115. <TextBlock x:Name="ChangeIcon" Grid.Column="1" Width="5" Margin="3,4,2,0" HorizontalAlignment="Left" VerticalAlignment="Top" IsHitTestVisible="False" Text="*" Visibility="{Binding FileChanged}" />
  116. <Button x:Name="CloseFileButton" Grid.Column="2" Width="16" Height="16" Margin="0,4,8,4" Background="Transparent" BorderThickness="0" Template="{StaticResource CloseFileButton}" Click="CloseFileButton_Click"></Button>
  117. </Grid>
  118. </Border>
  119. </Grid>
  120. <ControlTemplate.Triggers>
  121. <Trigger Property="IsSelected" Value="True">
  122. <Setter TargetName="Title" Property="Background" Value="#FFFFFF" />
  123. <Setter TargetName="Title" Property="BorderThickness" Value="1,1,1,0" />
  124. <Setter TargetName="TextTitle" Property="Foreground" Value="Black" />
  125. <Setter TargetName="ChangeIcon" Property="Foreground" Value="Black" />
  126. </Trigger>
  127. <Trigger Property="IsSelected" Value="False">
  128. <Setter TargetName="Title" Property="Background" Value="TransParent" />
  129. <Setter TargetName="Title" Property="BorderThickness" Value="1,1,1,0" />
  130. <Setter TargetName="TextTitle" Property="Foreground" Value="White" />
  131. <Setter TargetName="ChangeIcon" Property="Foreground" Value="white" />
  132. </Trigger>
  133. <MultiDataTrigger>
  134. <MultiDataTrigger.Conditions>
  135. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false" />
  136. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
  137. </MultiDataTrigger.Conditions>
  138. <Setter TargetName="Title" Property="Background" Value="#0D000000" />
  139. <Setter TargetName="TextTitle" Property="Foreground" Value="black" />
  140. <Setter TargetName="ChangeIcon" Property="Foreground" Value="black" />
  141. </MultiDataTrigger>
  142. </ControlTemplate.Triggers>
  143. </ControlTemplate>
  144. </Setter.Value>
  145. </Setter>
  146. </Style>
  147. <Style x:Key="TitleBarButtonStyle" TargetType="Button">
  148. <Setter Property="Foreground" Value="#FFFFFF" />
  149. <Setter Property="Padding" Value="0" />
  150. <Setter Property="Margin" Value="0" />
  151. <Setter Property="VerticalAlignment" Value="Top" />
  152. <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
  153. <Setter Property="IsTabStop" Value="False" />
  154. <Setter Property="Width" Value="36" />
  155. <Setter Property="Height" Value="30" />
  156. <Setter Property="Template">
  157. <Setter.Value>
  158. <ControlTemplate TargetType="{x:Type Button}">
  159. <Border x:Name="border"
  160. Background="Transparent"
  161. BorderThickness="0"
  162. SnapsToDevicePixels="True">
  163. <ContentPresenter x:Name="contentPresenter"
  164. Margin="0"
  165. HorizontalAlignment="Center"
  166. VerticalAlignment="Center"
  167. Focusable="False"
  168. RecognizesAccessKey="True" />
  169. </Border>
  170. <ControlTemplate.Triggers>
  171. <Trigger Property="IsMouseOver" Value="true">
  172. <Setter TargetName="border" Property="Background" Value="#1AE9E9E9" />
  173. </Trigger>
  174. <Trigger Property="IsPressed" Value="true">
  175. <Setter TargetName="border" Property="Background" Value="#1AEDEDED" />
  176. </Trigger>
  177. </ControlTemplate.Triggers>
  178. </ControlTemplate>
  179. </Setter.Value>
  180. </Setter>
  181. </Style>
  182. <Style x:Key="TitleBarCloseButtonStyle" BasedOn="{StaticResource TitleBarButtonStyle}" TargetType="Button">
  183. <Setter Property="Template">
  184. <Setter.Value>
  185. <ControlTemplate TargetType="{x:Type Button}">
  186. <Border x:Name="border"
  187. Background="Transparent"
  188. BorderThickness="0"
  189. SnapsToDevicePixels="True">
  190. <ContentPresenter x:Name="contentPresenter"
  191. Margin="0"
  192. HorizontalAlignment="Center"
  193. VerticalAlignment="Center"
  194. Focusable="False"
  195. RecognizesAccessKey="True" />
  196. </Border>
  197. <ControlTemplate.Triggers>
  198. <Trigger Property="IsMouseOver" Value="true">
  199. <Setter TargetName="border" Property="Background" Value="#C42B1C" />
  200. </Trigger>
  201. <Trigger Property="IsPressed" Value="true">
  202. <Setter TargetName="border" Property="Background" Value="#C84031" />
  203. </Trigger>
  204. </ControlTemplate.Triggers>
  205. </ControlTemplate>
  206. </Setter.Value>
  207. </Setter>
  208. </Style>
  209. </Window.Resources>
  210. <Grid>
  211. <Grid Background="#273C62" Margin="0,-1,0,0">
  212. <dragablz:TabablzControl Name="TabControl" ItemContainerStyle="{StaticResource DragablzItemStyle}" WindowChrome.IsHitTestVisibleInChrome="True">
  213. <dragablz:TabablzControl.InterTabController>
  214. <dragablz:InterTabController />
  215. </dragablz:TabablzControl.InterTabController>
  216. <dragablz:TabablzControl.HeaderSuffixContent>
  217. <Grid Name="TitleBarGrid" MinHeight="32">
  218. <Grid.ColumnDefinitions>
  219. <ColumnDefinition Width="auto"></ColumnDefinition>
  220. <ColumnDefinition Width="*"></ColumnDefinition>
  221. <ColumnDefinition Width="auto"></ColumnDefinition>
  222. </Grid.ColumnDefinitions>
  223. <Button x:Name="addBtn" Width="16" Height="16" Margin="9,7,0,5" HorizontalAlignment="Left" Background="Transparent" BorderThickness="0"
  224. Click="DefaultAddButton_Click" Template="{StaticResource AddFileButton}"></Button>
  225. <Grid Grid.Column="2" HorizontalAlignment="Right">
  226. <StackPanel Orientation="Horizontal" Margin="0,-2,0,0">
  227. <Button x:Name="MinimizeButton" Style="{StaticResource TitleBarButtonStyle}" Width="36" Height="32" Click="MinimizeButton_Click">
  228. <Path Width="36" Height="32"
  229. Data="M 13,15 H 23"
  230. Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
  231. StrokeThickness="1" />
  232. </Button>
  233. <Button x:Name="MaximizeRestoreButton" Style="{StaticResource TitleBarButtonStyle}" Width="36" Height="32" Click="MaximizeRestoreButton_Click">
  234. <Path Width="36" Height="32"
  235. Data="{Binding ElementName=Window, Path=WindowState, Converter={StaticResource WindowStateToPathConverter}}"
  236. Stroke="{Binding Path=Foreground,RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
  237. StrokeThickness="1" />
  238. </Button>
  239. <Button x:Name="CloseButton" Style="{StaticResource TitleBarCloseButtonStyle}" Width="36" Height="32" Click="CloseButton_Click">
  240. <Path Width="36" Height="32"
  241. Data="M 13,11 22,20 M 13,20 22,11"
  242. Stroke="{Binding Path=Foreground,RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
  243. StrokeThickness="1" />
  244. </Button>
  245. </StackPanel>
  246. </Grid>
  247. </Grid>
  248. </dragablz:TabablzControl.HeaderSuffixContent>
  249. </dragablz:TabablzControl>
  250. </Grid>
  251. <Border Name="PopupBorder" Background="#A0000000" Visibility="Collapsed">
  252. <cpdfcommon:PasswordDialog x:Name="PasswordUI" Visibility="Collapsed"></cpdfcommon:PasswordDialog>
  253. </Border>
  254. </Grid>
  255. </Window>