RecentFilesView.xaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <UserControl x:Class="PDF_Office.Views.HomePanel.RecentFiles.RecentFilesView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:PDF_Office.Views.HomePanel.RecentFiles"
  7. xmlns:customControl ="clr-namespace:PDF_Office.CustomControl"
  8. mc:Ignorable="d" Loaded="UserControl_Loaded"
  9. d:DesignHeight="450" d:DesignWidth="800">
  10. <UserControl.Resources>
  11. <ResourceDictionary>
  12. <ResourceDictionary.MergedDictionaries>
  13. <ResourceDictionary Source="../../../Styles/ListViewStyle.xaml"/>
  14. <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml"/>
  15. </ResourceDictionary.MergedDictionaries>
  16. <DataTemplate x:Key="listviewItem">
  17. <local:DocItemListViewControl HorizontalAlignment="Stretch"
  18. FileInfoItemHandler="FileInfoMenuItem_Click"
  19. PrintItemHandler="PrintMenuItem_Click"
  20. DeleteItemHandler="DeleteItemHandler_Click"
  21. ShareItemHandler="ShareMenuItem_Click"
  22. FilePathItemHandler ="FilePathMenuItem_Click"
  23. />
  24. </DataTemplate>
  25. <DataTemplate x:Key="gridviewItem">
  26. <local:DocItemControl HorizontalAlignment="Stretch"/>
  27. </DataTemplate>
  28. <ItemsPanelTemplate x:Key="listPanel">
  29. <StackPanel Orientation="Vertical"/>
  30. </ItemsPanelTemplate>
  31. <ItemsPanelTemplate x:Key="gridPanel">
  32. <WrapPanel />
  33. </ItemsPanelTemplate>
  34. <ContextMenu x:Key="FlyoutMenu" FontSize="14"
  35. Opened="ContextMenu_Opened">
  36. <ContextMenu.ItemContainerStyle>
  37. <Style TargetType="MenuItem">
  38. <Setter Property="Padding" Value="0,7,0,7"/>
  39. <Setter Property="VerticalContentAlignment" Value="Center"/>
  40. </Style>
  41. </ContextMenu.ItemContainerStyle>
  42. <MenuItem Name="DeleteMenuItem" Header="删除" IsEnabled="True" Click="DeleteMenuItem_Click">
  43. <MenuItem.Icon>
  44. <Path Fill="Black" Data="M9 0H3V2H0V3H1V14H11V3H12V2H9V0ZM2 13V3H3H4H8H9H10V13H2ZM8 2V1H4V2H8ZM4 12V4H3V12H4ZM6.5 4V12H5.5V4H6.5ZM9 12V4H8V12H9Z">
  45. <Path.RenderTransform>
  46. <TranslateTransform X="5.0000" Y="0"/>
  47. </Path.RenderTransform>
  48. </Path>
  49. </MenuItem.Icon>
  50. </MenuItem>
  51. <MenuItem Name="PrintMenuItem" x:Uid="HomePage/RecentFiles_Print" Header="打印" IsEnabled="True" Click="PrintMenuItem_Click">
  52. <MenuItem.Icon>
  53. <Path Fill="Black"
  54. Data="M12,0 L12,6 L14.5,6 C15.2796961,6 15.9204487,6.59488808 15.9931334,7.35553999 L16,7.5 L16,14 L12,14 L12,16 L4,16 L4,14 L0,14 L0,7.5 C0,6.72030388 0.594888083,6.07955132 1.35553999,6.00686658 L1.5,6 L4,6 L4,0 L12,0 Z M11,11 L5,11 L5,15 L11,15 L11,11 Z M14.5,7 L1.5,7 C1.25454011,7 1.05039163,7.17687516 1.00805567,7.41012437 L1,7.5 L1,13 L4,13 L4,10 L12,10 L12,13 L15,13 L15,7.5 C15,7.25454011 14.8231248,7.05039163 14.5898756,7.00805567 L14.5,7 Z M3,8 L3,9 L2,9 L2,8 L3,8 Z M11,1 L5,1 L5,6 L11,6 L11,1 Z" >
  55. <Path.RenderTransform>
  56. <TranslateTransform X="3.0000" Y="0"/>
  57. </Path.RenderTransform>
  58. </Path>
  59. </MenuItem.Icon>
  60. </MenuItem>
  61. <MenuItem Name="ShareMenuItem" Header="分享" IsEnabled="True" Click="ShareMenuItem_Click">
  62. <MenuItem.Icon>
  63. <Path Fill="Black"
  64. Data="M1,5 L1,15 L15,15 L15,13 L16,13 L16,16 L0,16 L0,5 L1,5 Z M10,1 L15.5,6.5 L10,12 L10,9 C9.33333333,9 8.68098958,9.06640625 8.04296875,9.19921875 C7.40494792,9.33203125 6.7890625,9.52734375 6.1953125,9.78515625 C5.6015625,10.0429688 5.03515625,10.3580729 4.49609375,10.7304688 C4.06484375,11.0283854 3.65942708,11.3588021 3.27984375,11.7217188 L3,12 L3,11 C3,10.3541667 3.08333333,9.73307292 3.25,9.13671875 C3.41666667,8.54036458 3.65234375,7.98307292 3.95703125,7.46484375 C4.26171875,6.94661458 4.62630208,6.47526042 5.05078125,6.05078125 C5.47526042,5.62630208 5.94661458,5.26171875 6.46484375,4.95703125 C6.98307292,4.65234375 7.54036458,4.41666667 8.13671875,4.25 C8.61380208,4.11666667 9.10671875,4.03666667 9.61546875,4.01 L10,4 L10,1 Z M11,3.4140625 L11,5 L10.59025,5.000625 C10.378125,5.00125 10.165625,5.00234375 10,5.00390625 C9.72395833,5.00651042 9.56380208,5.02083333 9.30078125,5.046875 C9.03776042,5.07291667 8.7734375,5.11848958 8.5078125,5.18359375 C8.2421875,5.24869792 7.9609375,5.34375 7.6640625,5.46875 C7.2109375,5.65625 6.79036458,5.89583333 6.40234375,6.1875 C6.01432292,6.47916667 5.66796875,6.81119792 5.36328125,7.18359375 C5.05859375,7.55598958 4.80078125,7.95963542 4.58984375,8.39453125 C4.37890625,8.82942708 4.22395833,9.28645833 4.125,9.765625 C5,9.18229167 5.93489583,8.7421875 6.9296875,8.4453125 C7.80013021,8.18554688 8.69250488,8.03942871 9.60681152,8.00695801 L10,8 L11,8 L11,9.5 L14,6.5 L11,3.4140625 Z">
  65. <Path.RenderTransform>
  66. <TranslateTransform X="3.0000" Y="0"/>
  67. </Path.RenderTransform>
  68. </Path>
  69. </MenuItem.Icon>
  70. </MenuItem>
  71. <MenuItem Name="FileInfoMenuItem" Header="文件信息" IsEnabled="True" Click="FileInfoMenuItem_Click">
  72. <MenuItem.Icon>
  73. <Path Fill="Black"
  74. Data="M8,1.42108547e-13 C12.418278,1.42108547e-13 16,3.581722 16,8 C16,12.418278 12.418278,16 8,16 C3.581722,16 0,12.418278 0,8 C0,3.581722 3.581722,1.42108547e-13 8,1.42108547e-13 Z M8,1.06666667 C4.17082573,1.06666667 1.06666667,4.17082573 1.06666667,8 C1.06666667,11.8291743 4.17082573,14.9333333 8,14.9333333 C11.8291743,14.9333333 14.9333333,11.8291743 14.9333333,8 C14.9333333,4.17082573 11.8291743,1.06666667 8,1.06666667 Z M8.5,6 L8.5,12 L7.5,12 L7.5,6 L8.5,6 Z M8.5,4 L8.5,5 L7.5,5 L7.5,4 L8.5,4 Z">
  75. <Path.RenderTransform>
  76. <TranslateTransform X="3.0000" Y="0"/>
  77. </Path.RenderTransform>
  78. </Path>
  79. </MenuItem.Icon>
  80. </MenuItem>
  81. <MenuItem Name="FilePathMenuItem" Header="FilePath" IsEnabled="True" Click="FilePathMenuItem_Click">
  82. <MenuItem.Icon>
  83. <Path Fill="Black"
  84. Data="M5.24031 1.5H0.5V14.5H15.5V4H7.24031L5.24031 1.5ZM1.5 13.5V2.5H4.75969L6.75969 5H14.5V13.5H1.5ZM4 7.5H12V6.5H4V7.5Z">
  85. <Path.RenderTransform>
  86. <TranslateTransform X="3.0000" Y="0"/>
  87. </Path.RenderTransform>
  88. </Path>
  89. </MenuItem.Icon>
  90. </MenuItem>
  91. </ContextMenu>
  92. <Style x:Key="SubFilesListViewItemStyle" BasedOn="{StaticResource FilesListViewItemStyle}" TargetType="{x:Type ListViewItem}">
  93. <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>
  94. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  95. <Setter Property="Margin" Value="12,0,0,0"/>
  96. <EventSetter Event="PreviewMouseRightButtonDown"
  97. Handler="ListViewItem_PreviewMouseRightButtonDown"/>
  98. <EventSetter Event="PreviewMouseDoubleClick"
  99. Handler="RecentFilesList_PreviewMouseDoubleClick"/>
  100. </Style>
  101. <Style x:Key="HomeGridViewItemStyle" BasedOn="{StaticResource FilesGridItemStyle}" TargetType="{x:Type ListViewItem}">
  102. <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>
  103. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  104. <EventSetter Event="PreviewMouseRightButtonDown"
  105. Handler="ListViewItem_PreviewMouseRightButtonDown"/>
  106. <EventSetter Event="PreviewMouseDoubleClick"
  107. Handler="RecentFilesList_PreviewMouseDoubleClick"/>
  108. </Style>
  109. </ResourceDictionary>
  110. </UserControl.Resources>
  111. <Grid>
  112. <Grid>
  113. <Grid.RowDefinitions>
  114. <RowDefinition Height="Auto"/>
  115. <RowDefinition Height="Auto"/>
  116. <RowDefinition />
  117. </Grid.RowDefinitions>
  118. <Grid x:Name="GridRecentFilesTile" Margin="32,38,0,13">
  119. <TextBlock x:Name="TxbRecentlyTile" Text="Recent" HorizontalAlignment="Left" FontWeight="Semibold" FontSize="24" Padding="0,6,0,0" Margin="0,0,0,0"/>
  120. <StackPanel x:Name="PnlRightBtns" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,0,0" Orientation="Horizontal" HorizontalAlignment="Right">
  121. <customControl:CustomIconToggleBtn x:Name="BtnListMode" Tag="ListMode" Width="32" Height="24" Click="ListModeBtn_Click"
  122. Style="{StaticResource ToggleBtnViewModeStyle}">
  123. <StackPanel Orientation="Horizontal" Margin="8,0,8,0">
  124. <Path Fill="Black" Data="M15 2H1V7H15V2ZM14 3V6H2V3H14ZM15 9H1V14H15V9ZM14 10V13H2V10H14Z"/>
  125. </StackPanel>
  126. </customControl:CustomIconToggleBtn>
  127. <customControl:CustomIconToggleBtn x:Name="BtnGridMode" Margin="0" Width="32" Height="24" Tag="GridMode" Click="GridModeBtn_Click"
  128. Style="{StaticResource ToggleBtnViewModeStyle}">
  129. <StackPanel Orientation="Horizontal" Margin="8,0,8,0">
  130. <Path Fill="Black" Data="M7 2H2V7H7V2ZM6 3V6H3V3H6ZM14 2H9V7H14V2ZM13 3V6H10V3H13ZM2 9H7V14H2V9ZM6 13V10H3V13H6ZM14 9H9V14H14V9ZM13 10V13H10V10H13Z"/>
  131. </StackPanel>
  132. </customControl:CustomIconToggleBtn>
  133. <Separator Margin="1 0 1 0" Width="1" Height="16" BorderBrush="#1A000000" BorderThickness="1"/>
  134. <Button x:Name="BtnDelete" Margin="0" Padding="0,0,0,0" MaxHeight="40" Width="20" Height="20" Background="Transparent" BorderThickness="0" Click="btnDelete_Click"
  135. >
  136. <StackPanel Orientation="Horizontal">
  137. <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="4,0,4,0">
  138. <Path Fill="Black" VerticalAlignment="Center" Data="M9 0H3V2H0V3H1V14H11V3H12V2H9V0ZM2 13V3H3H4H8H9H10V13H2ZM8 2V1H4V2H8ZM4 12V4H3V12H4ZM6.5 4V12H5.5V4H6.5ZM9 12V4H8V12H9Z"/>
  139. </StackPanel>
  140. </StackPanel>
  141. </Button>
  142. </StackPanel>
  143. </Grid>
  144. <Grid Grid.Row="2">
  145. <Grid.ColumnDefinitions>
  146. <ColumnDefinition Width="799*"/>
  147. <ColumnDefinition Width="*"/>
  148. </Grid.ColumnDefinitions>
  149. <ListView x:Name="RecentFilesList" Margin="32,0,0,0"
  150. VirtualizingPanel.IsVirtualizing="True"
  151. VirtualizingPanel.CacheLengthUnit="Page"
  152. VirtualizingPanel.CacheLength="1"
  153. VirtualizingPanel.ScrollUnit="Pixel"
  154. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  155. ScrollViewer.VerticalScrollBarVisibility="Auto"
  156. Background="Transparent" BorderThickness="0"
  157. Padding="0,0,0,0" MinHeight="216" MinWidth="380"
  158. SelectionMode="Multiple"
  159. SelectionChanged="RecentFilesList_SelectionChanged"
  160. ItemContainerStyle="{StaticResource SubFilesListViewItemStyle}"
  161. Style="{StaticResource FilesListViewStyle}"
  162. ItemTemplate="{StaticResource listviewItem}"
  163. ItemsPanel="{StaticResource listPanel}" Grid.ColumnSpan="2"
  164. >
  165. </ListView>
  166. <ListView x:Name="GridRecentFilesList" Margin="32,0,0,0" Visibility="Collapsed"
  167. VirtualizingPanel.IsVirtualizing="True"
  168. VirtualizingPanel.CacheLengthUnit="Page"
  169. VirtualizingPanel.CacheLength="1"
  170. VirtualizingPanel.ScrollUnit="Pixel"
  171. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  172. ScrollViewer.VerticalScrollBarVisibility="Auto"
  173. Background="Transparent" BorderThickness="0"
  174. Padding="0,0,0,0" MinHeight="216" MinWidth="380"
  175. SelectionMode="Multiple"
  176. SelectionChanged="GridRecentFilesList_SelectionChanged"
  177. ItemContainerStyle="{StaticResource HomeGridViewItemStyle}"
  178. Style="{StaticResource FilesGridViewStyle}"
  179. ItemTemplate="{StaticResource gridviewItem}"
  180. ItemsPanel="{StaticResource gridPanel}" Grid.ColumnSpan="2"
  181. >
  182. </ListView>
  183. </Grid>
  184. <StackPanel x:Name="BlankContentPanel" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed">
  185. <!--<Image Source="../../Resources/Image/Home/empty_recent2x.png" Width="140" Height="140" Stretch="Uniform" VerticalAlignment="Center"/>-->
  186. <TextBlock x:Name="NoFilesText" Text="No documents" TextAlignment="Center" HorizontalAlignment="Center" FontSize="16" LineHeight="22" Foreground="#FF333333" FontFamily="Segoe UI" />
  187. <StackPanel Orientation="Horizontal" Margin="0,12,0,0">
  188. <TextBlock x:Name="clickFileText" Text="Drop documents here or click the '" Foreground="#FF999999" VerticalAlignment="Center" FontSize="14"/>
  189. <TextBlock Margin="2,0,2,0" VerticalAlignment="Center" FontSize="15">
  190. <Hyperlink Click="OpenFiles_Click">
  191. <TextBlock x:Name="OpenFilesLinkText" Text="Open Files"/>
  192. </Hyperlink>
  193. </TextBlock>
  194. <TextBlock x:Name="dropFileText" Text="' button in the Sidebar" Foreground="#FF999999" VerticalAlignment="Center" FontSize="14"/>
  195. </StackPanel>
  196. </StackPanel>
  197. </Grid>
  198. </Grid>
  199. </UserControl>