MainWindow.xaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <Window
  2. x:Class="PDF_Office.Views.MainWindow"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:convert="clr-namespace:PDF_Office.DataConvert"
  6. xmlns:cus="clr-namespace:PDF_Office.CustomControl"
  7. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  8. xmlns:dragablz="http://dragablz.net/winfx/xaml/dragablz"
  9. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  10. xmlns:local="clr-namespace:PDF_Office"
  11. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  12. xmlns:prism="http://prismlibrary.com/"
  13. xmlns:viewmodels="clr-namespace:PDF_Office.ViewModels"
  14. Width="1280"
  15. Height="800"
  16. MinWidth="540"
  17. MinHeight="460"
  18. d:DataContext="{d:DesignInstance Type=viewmodels:MainWindowViewModel}"
  19. prism:ViewModelLocator.AutoWireViewModel="True"
  20. Activated="Window_Activated"
  21. Closed="Window_Closed"
  22. SizeChanged="Window_SizeChanged"
  23. Style="{StaticResource WindowStyle}"
  24. UseLayoutRounding="True"
  25. WindowStartupLocation="CenterScreen"
  26. mc:Ignorable="d">
  27. <Window.Resources>
  28. <ResourceDictionary>
  29. <Style x:Key="DragablzItemStyle" TargetType="{x:Type dragablz:DragablzItem}">
  30. <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
  31. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv2}" />
  32. <Setter Property="Template">
  33. <Setter.Value>
  34. <ControlTemplate TargetType="dragablz:DragablzItem">
  35. <Grid x:Name="templateRoot">
  36. <Grid.ColumnDefinitions>
  37. <ColumnDefinition Width="*" />
  38. <ColumnDefinition Width="auto" />
  39. </Grid.ColumnDefinitions>
  40. <Border
  41. x:Name="Title"
  42. Width="184"
  43. Height="34"
  44. Margin="4,6,0,2"
  45. BorderBrush="{StaticResource color.sys.border.neutral.lv3}"
  46. BorderThickness="0"
  47. CornerRadius="4,4,0,0"
  48. WindowChrome.IsHitTestVisibleInChrome="True">
  49. <Grid>
  50. <Grid.ColumnDefinitions>
  51. <ColumnDefinition Width="auto" />
  52. <ColumnDefinition Width="*" MinWidth="10" />
  53. <ColumnDefinition Width="auto" />
  54. </Grid.ColumnDefinitions>
  55. <StackPanel Orientation="Horizontal">
  56. <Path
  57. Name="Ico_Home"
  58. Width="20"
  59. Height="20"
  60. Margin="8,7,0,7"
  61. Data="M3.8655 5.79659C3.32363 6.16983 3 6.78571 3 7.44369V15.0001C3 16.1046 3.89543 17.0001 5 17.0001H9V12.1786H11V17.0001H15C16.1046 17.0001 17 16.1046 17 15.0001V7.44369C17 6.78571 16.6764 6.16983 16.1345 5.79659L11.1345 2.35266C10.4514 1.88212 9.54865 1.88212 8.8655 2.35266L3.8655 5.79659Z"
  62. Fill="{TemplateBinding Foreground}"
  63. Visibility="Collapsed" />
  64. <TextBlock
  65. x:Name="TextTitle"
  66. MaxWidth="145"
  67. Margin="8,7"
  68. VerticalAlignment="Center"
  69. FontFamily="Segoe UI,Microsoft YaHei"
  70. Foreground="{TemplateBinding Foreground}"
  71. Text="{Binding DataContext.FileName}"
  72. TextTrimming="WordEllipsis" />
  73. </StackPanel>
  74. <Thumb
  75. x:Name="PART_Thumb"
  76. Grid.ColumnSpan="2"
  77. HorizontalAlignment="Stretch"
  78. VerticalContentAlignment="Stretch"
  79. Background="Transparent"
  80. FontFamily="Segoe UI,Microsoft YaHei"
  81. ToolTip="{Binding DataContext.FileName}">
  82. <Thumb.Template>
  83. <ControlTemplate>
  84. <Grid Background="Transparent" />
  85. </ControlTemplate>
  86. </Thumb.Template>
  87. </Thumb>
  88. <TextBlock
  89. x:Name="ChangeIcon"
  90. Grid.Column="1"
  91. Width="5"
  92. Margin="3,4,2,0"
  93. HorizontalAlignment="Left"
  94. VerticalAlignment="Top"
  95. Foreground="{TemplateBinding Foreground}"
  96. IsHitTestVisible="False"
  97. Text="*"
  98. Visibility="{Binding DataContext.FileChanged}" />
  99. <Button
  100. Grid.Column="2"
  101. Width="16"
  102. Height="16"
  103. Margin="0,4,8,4"
  104. Background="Transparent"
  105. BorderThickness="0"
  106. Command="{Binding DataContext.CloseTab}"
  107. CommandParameter="{Binding}">
  108. <Path Data="M6.50006 7.06072L9.96973 10.5304L11.0304 9.46973L7.56072 6.00006L11.0304 2.53039L9.96973 1.46973L6.50006 4.9394L3.03039 1.46973L1.96973 2.53039L5.4394 6.00006L1.96973 9.46973L3.03039 10.5304L6.50006 7.06072Z" Fill="{StaticResource color.icon.base.neutral.norm.lv2}" />
  109. </Button>
  110. </Grid>
  111. </Border>
  112. <Grid.ContextMenu>
  113. <ContextMenu>
  114. <MenuItem Header="Rename" />
  115. <MenuItem Header="Show In Folder" />
  116. <MenuItem Header="Close Tab" />
  117. <MenuItem Header="Close All Tab" />
  118. <MenuItem Header="Open In New Window" />
  119. </ContextMenu>
  120. </Grid.ContextMenu>
  121. </Grid>
  122. <ControlTemplate.Triggers>
  123. <Trigger Property="IsSelected" Value="True">
  124. <Setter TargetName="Title" Property="Background" Value="{StaticResource color.sys.layout.mg}" />
  125. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
  126. <Setter TargetName="Title" Property="BorderThickness" Value="0,0,0,1" />
  127. </Trigger>
  128. <Trigger Property="IsSelected" Value="False">
  129. <Setter TargetName="Title" Property="Background" Value="TransParent" />
  130. </Trigger>
  131. <Trigger Property="IsMouseOver" Value="True">
  132. <Setter TargetName="Title" Property="Background" Value="{StaticResource color.item-state.hov.bg}" />
  133. </Trigger>
  134. <Trigger SourceName="TextTitle" Property="Text" Value="Home">
  135. <Setter TargetName="Ico_Home" Property="Visibility" Value="Visible" />
  136. </Trigger>
  137. <MultiDataTrigger>
  138. <MultiDataTrigger.Conditions>
  139. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false" />
  140. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
  141. </MultiDataTrigger.Conditions>
  142. <Setter TargetName="Title" Property="Background" Value="#0D000000" />
  143. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
  144. <!--<Setter TargetName="btnPath" Property="Path.Fill" Value="Black"/>-->
  145. </MultiDataTrigger>
  146. </ControlTemplate.Triggers>
  147. </ControlTemplate>
  148. </Setter.Value>
  149. </Setter>
  150. </Style>
  151. <convert:UnVisivleConvert x:Key="UnvisibleConvert" />
  152. </ResourceDictionary>
  153. </Window.Resources>
  154. <Border>
  155. <Grid Background="{StaticResource color.sys.layout.bg.tabbar}">
  156. <Grid.RowDefinitions>
  157. <RowDefinition Height="40" />
  158. <RowDefinition Height="*" />
  159. </Grid.RowDefinitions>
  160. <dragablz:TabablzControl
  161. Name="TabablzControl"
  162. Grid.RowSpan="3"
  163. BorderThickness="0"
  164. ItemContainerStyle="{StaticResource DragablzItemStyle}"
  165. SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
  166. WindowChrome.IsHitTestVisibleInChrome="True">
  167. <dragablz:TabablzControl.InterTabController>
  168. <dragablz:InterTabController InterTabClient="{Binding InterTabClient}" />
  169. </dragablz:TabablzControl.InterTabController>
  170. <dragablz:TabablzControl.HeaderSuffixContent>
  171. <Button
  172. x:Name="BtnAdd"
  173. Width="20"
  174. Height="20"
  175. Margin="8,13,200,7"
  176. Padding="0"
  177. HorizontalAlignment="Left"
  178. Background="Transparent"
  179. BorderThickness="0"
  180. Command="{Binding AddTab}"
  181. WindowChrome.IsHitTestVisibleInChrome="True">
  182. <Path
  183. Width="20"
  184. Height="20"
  185. Data="M9 11V16H11V11H16V9H11V4H9V9H4L4 11H9Z"
  186. Fill="{StaticResource color.icon.base.neutral.norm.lv1}" />
  187. </Button>
  188. </dragablz:TabablzControl.HeaderSuffixContent>
  189. <dragablz:TabablzControl.HeaderPrefixContent>
  190. <Grid
  191. Width="16"
  192. Height="38"
  193. Margin="0,0,0,0"
  194. Background="Transparent" />
  195. </dragablz:TabablzControl.HeaderPrefixContent>
  196. </dragablz:TabablzControl>
  197. <!-- 标题栏右侧栏,关闭按钮,会员,试用等 -->
  198. <StackPanel
  199. Name="StkPnlRight"
  200. HorizontalAlignment="Right"
  201. Orientation="Horizontal"
  202. WindowChrome.IsHitTestVisibleInChrome="True">
  203. <Button
  204. Name="BtnMiniSize"
  205. Width="40"
  206. Height="40"
  207. Background="Transparent"
  208. BorderThickness="0"
  209. Click="BtnMiniSize_Click"
  210. Style="{StaticResource TitleBarBtn}">
  211. <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="14 7 14 8 2 8 2 7">
  212. <Polygon.RenderTransform>
  213. <TransformGroup>
  214. <TranslateTransform Y="-3" />
  215. </TransformGroup>
  216. </Polygon.RenderTransform>
  217. </Polygon>
  218. </Button>
  219. <Button
  220. Name="BtnReStore"
  221. Width="40"
  222. Height="40"
  223. Background="Transparent"
  224. BorderThickness="0"
  225. Click="BtnReStore_Click"
  226. Style="{StaticResource TitleBarBtn}">
  227. <Grid>
  228. <Path
  229. x:Name="ico_max"
  230. Data="M14,2 L14,14 L2,14 L2,2 L14,2 Z M13,3 L3,3 L3,13 L13,13 L13,3 Z"
  231. Fill="{StaticResource color.btn.sec.text.def}"
  232. Visibility="Collapsed" />
  233. <Grid x:Name="ico_mini" Visibility="{Binding ElementName=ico_max, Path=Visibility, Converter={StaticResource UnvisibleConvert}}">
  234. <Path Data="M11,5 L11,14 L2,14 L2,5 L11,5 Z M10,6 L3,6 L3,13 L10,13 L10,6 Z" Fill="{StaticResource color.btn.sec.text.def}" />
  235. <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="14 2 14 11 11 11 11 10 13 10 13 3 6 3 6 5 5 5 5 2" />
  236. </Grid>
  237. </Grid>
  238. </Button>
  239. <Button
  240. Name="BtnClose"
  241. Width="40"
  242. Height="40"
  243. Background="Transparent"
  244. BorderThickness="0"
  245. Click="BtnClose_Click"
  246. Style="{StaticResource CloseBtn}">
  247. <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="11.2919922 12 12 11.2919922 6.70800781 6 12 0.708007813 11.2919922 0 6 5.29199219 0.708007812 9.76996262e-15 -2.27456942e-13 0.708007813 5.29199219 6 0 11.2919922 0.708007812 12 6 6.70800781" />
  248. </Button>
  249. </StackPanel>
  250. </Grid>
  251. </Border>
  252. </Window>