RecentFilesContent.xaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <UserControl
  2. x:Class="PDF_Office.Views.HomePanel.RecentFiles.RecentFilesContent"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:DataConvert="clr-namespace:PDF_Office.DataConvert"
  6. xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
  7. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  8. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  9. xmlns:local="clr-namespace:PDF_Office.Views.HomePanel.RecentFiles"
  10. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  11. xmlns:prism="http://prismlibrary.com/"
  12. xmlns:recentfiles="clr-namespace:PDF_Office.ViewModels.HomePanel.RecentFiles"
  13. d:DataContext="{d:DesignInstance Type=recentfiles:RecentFilesContentViewModel}"
  14. d:DesignHeight="450"
  15. d:DesignWidth="800"
  16. prism:ViewModelLocator.AutoWireViewModel="True"
  17. Loaded="UserControl_Loaded"
  18. KeyDown="UserControl_KeyDown"
  19. mc:Ignorable="d">
  20. <UserControl.Resources>
  21. <ResourceDictionary>
  22. <ResourceDictionary.MergedDictionaries>
  23. <ResourceDictionary Source="../../../Styles/ListViewStyle.xaml" />
  24. <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml" />
  25. <ResourceDictionary Source="../../../Styles/RadioButtonStyle.xaml" />
  26. <ResourceDictionary Source="../../../Styles/ButtonStyle.xaml" />
  27. </ResourceDictionary.MergedDictionaries>
  28. <DataConvert:BoolToVisible x:Key="BoolToVisible" />
  29. <DataConvert:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert" />
  30. <DataConvert:InvertBoolConvert x:Key="InvertBoolConvert" />
  31. <DataTemplate x:Key="listviewItem">
  32. <local:DocItemListViewControl
  33. HorizontalAlignment="Stretch"
  34. DeleteItemHandler="DocItemListViewControl_DeleteItemHandler"
  35. OpenFileItemHandler="DocItemListViewControl_OpenFileItemHandler" />
  36. </DataTemplate>
  37. <DataTemplate x:Key="gridviewItem">
  38. <local:DocItemControl HorizontalAlignment="Stretch" />
  39. </DataTemplate>
  40. <ItemsPanelTemplate x:Key="listPanel">
  41. <StackPanel Orientation="Vertical" />
  42. </ItemsPanelTemplate>
  43. <ItemsPanelTemplate x:Key="gridPanel">
  44. <WrapPanel />
  45. </ItemsPanelTemplate>
  46. <ContextMenu
  47. x:Key="FlyoutMenu"
  48. FontSize="14"
  49. Opened="ContextMenu_Opened">
  50. <ContextMenu.ItemContainerStyle>
  51. <Style TargetType="MenuItem">
  52. <Setter Property="Padding" Value="0,7,0,7" />
  53. <Setter Property="VerticalContentAlignment" Value="Center" />
  54. </Style>
  55. </ContextMenu.ItemContainerStyle>
  56. <MenuItem
  57. Name="FilePathMenuItem"
  58. Click="FilePathMenuItem_Click"
  59. Header="{Binding T_MenuShow}"
  60. IsEnabled="True">
  61. <MenuItem.Icon>
  62. <Path 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" Fill="Black">
  63. <Path.RenderTransform>
  64. <TranslateTransform X="3.0000" Y="0" />
  65. </Path.RenderTransform>
  66. </Path>
  67. </MenuItem.Icon>
  68. </MenuItem>
  69. <MenuItem
  70. Name="DeleteMenuItem"
  71. Click="DeleteMenuItem_Click"
  72. Header="{Binding T_MenuRemove}"
  73. IsEnabled="True">
  74. <MenuItem.Icon>
  75. <Path Data="M9 0H3V2H0V3H1V14H11V3H12V2H9V0ZM2 13V3H3H4H8H9H10V13H2ZM8 2V1H4V2H8ZM4 12V4H3V12H4ZM6.5 4V12H5.5V4H6.5ZM9 12V4H8V12H9Z" Fill="Black">
  76. <Path.RenderTransform>
  77. <TranslateTransform X="5.0000" Y="0" />
  78. </Path.RenderTransform>
  79. </Path>
  80. </MenuItem.Icon>
  81. </MenuItem>
  82. </ContextMenu>
  83. <Style
  84. x:Key="SubFilesListViewItemStyle"
  85. BasedOn="{StaticResource FilesListViewItemStyle}"
  86. TargetType="{x:Type ListViewItem}">
  87. <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}" />
  88. <Setter Property="HorizontalContentAlignment" Value="Center" />
  89. <Setter Property="Margin" Value="0,0,0,0" />
  90. <EventSetter Event="PreviewMouseRightButtonDown" Handler="ListViewItem_PreviewMouseRightButtonDown" />
  91. <EventSetter Event="PreviewMouseDoubleClick" Handler="RecentFilesList_PreviewMouseDoubleClick" />
  92. </Style>
  93. <Style
  94. x:Key="HomeGridViewItemStyle"
  95. BasedOn="{StaticResource FilesGridItemStyle}"
  96. TargetType="{x:Type ListViewItem}">
  97. <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}" />
  98. <Setter Property="HorizontalContentAlignment" Value="Center" />
  99. <EventSetter Event="PreviewMouseRightButtonDown" Handler="ListViewItem_PreviewMouseRightButtonDown" />
  100. <EventSetter Event="PreviewMouseDoubleClick" Handler="RecentFilesList_PreviewMouseDoubleClick" />
  101. </Style>
  102. </ResourceDictionary>
  103. </UserControl.Resources>
  104. <Grid>
  105. <Grid>
  106. <Grid.RowDefinitions>
  107. <RowDefinition Height="Auto" />
  108. <RowDefinition Height="Auto" />
  109. <RowDefinition />
  110. </Grid.RowDefinitions>
  111. <Grid x:Name="GridRecentFilesTile" Margin="32,38,0,13">
  112. <TextBlock
  113. x:Name="TxbRecentlyTile"
  114. Margin="0,0,0,0"
  115. Padding="0,6,0,0"
  116. HorizontalAlignment="Left"
  117. FontFamily="Segoe UI"
  118. FontSize="20"
  119. FontWeight="Semibold"
  120. Text="{Binding T_Title}" />
  121. <StackPanel
  122. x:Name="PnlRightBtns"
  123. Grid.Column="0"
  124. Grid.ColumnSpan="2"
  125. Margin="0,0,0,0"
  126. HorizontalAlignment="Right"
  127. Orientation="Horizontal">
  128. <Border
  129. Height="32"
  130. Padding="2"
  131. Background="{StaticResource color.sys.layout.fg.dark}"
  132. CornerRadius="4">
  133. <StackPanel Orientation="Horizontal">
  134. <RadioButton
  135. x:Name="BtnGridMode"
  136. Width="32"
  137. Height="28"
  138. Padding="0"
  139. HorizontalContentAlignment="Center"
  140. VerticalContentAlignment="Center"
  141. GroupName="Mode"
  142. IsChecked="{Binding IsListMode, Converter={StaticResource InvertBoolConvert}, Mode=OneTime}"
  143. Style="{StaticResource ListModeRadioBtnStyle}"
  144. Tag="GridMode">
  145. <Path
  146. Width="32"
  147. Height="28"
  148. HorizontalAlignment="Center"
  149. VerticalAlignment="Center"
  150. Data="M10.8 7.25C9.94396 7.25 9.25 7.94396 9.25 8.8V12C9.25 12.856 9.94396 13.55 10.8 13.55H14C14.856 13.55 15.55 12.856 15.55 12V8.8C15.55 7.94396 14.856 7.25 14 7.25H10.8ZM10.75 8.8C10.75 8.77239 10.7724 8.75 10.8 8.75H14C14.0276 8.75 14.05 8.77239 14.05 8.8V12C14.05 12.0276 14.0276 12.05 14 12.05H10.8C10.7724 12.05 10.75 12.0276 10.75 12V8.8ZM10.8 14.45C9.94396 14.45 9.25 15.144 9.25 16V19.2C9.25 20.056 9.94396 20.75 10.8 20.75H14C14.856 20.75 15.55 20.056 15.55 19.2V16C15.55 15.144 14.856 14.45 14 14.45H10.8ZM10.75 16C10.75 15.9724 10.7724 15.95 10.8 15.95H14C14.0276 15.95 14.05 15.9724 14.05 16V19.2C14.05 19.2276 14.0276 19.25 14 19.25H10.8C10.7724 19.25 10.75 19.2276 10.75 19.2V16ZM16.45 8.8C16.45 7.94396 17.1439 7.25 18 7.25H21.2C22.056 7.25 22.75 7.94396 22.75 8.8V12C22.75 12.856 22.056 13.55 21.2 13.55H18C17.1439 13.55 16.45 12.856 16.45 12V8.8ZM18 8.75C17.9723 8.75 17.95 8.77239 17.95 8.8V12C17.95 12.0276 17.9723 12.05 18 12.05H21.2C21.2276 12.05 21.25 12.0276 21.25 12V8.8C21.25 8.77239 21.2276 8.75 21.2 8.75H18ZM18 14.45C17.1439 14.45 16.45 15.144 16.45 16V19.2C16.45 20.056 17.1439 20.75 18 20.75H21.2C22.056 20.75 22.75 20.056 22.75 19.2V16C22.75 15.144 22.056 14.45 21.2 14.45H18ZM17.95 16C17.95 15.9724 17.9723 15.95 18 15.95H21.2C21.2276 15.95 21.25 15.9724 21.25 16V19.2C21.25 19.2276 21.2276 19.25 21.2 19.25H18C17.9723 19.25 17.95 19.2276 17.95 19.2V16Z"
  151. Fill="{Binding ElementName=BtnGridMode, Path=Foreground}" />
  152. <i:Interaction.Triggers>
  153. <i:EventTrigger EventName="Checked">
  154. <i:InvokeCommandAction Command="{Binding ListModeCheckedCommand}" CommandParameter="{Binding ElementName=BtnGridMode, Path=Tag}" />
  155. </i:EventTrigger>
  156. </i:Interaction.Triggers>
  157. </RadioButton>
  158. <RadioButton
  159. x:Name="BtnListMode"
  160. Width="32"
  161. Height="28"
  162. Padding="0"
  163. HorizontalContentAlignment="Center"
  164. VerticalContentAlignment="Center"
  165. GroupName="Mode"
  166. IsChecked="{Binding IsListMode, Mode=OneTime}"
  167. Style="{StaticResource ListModeRadioBtnStyle}"
  168. Tag="ListMode">
  169. <Path
  170. Width="16"
  171. Height="16"
  172. Data="M15 3.75H1V2.25H15V3.75ZM15 8.75H1V7.25H15V8.75ZM1 13.75H15V12.25H1V13.75Z"
  173. Fill="{Binding ElementName=BtnListMode, Path=Foreground}" />
  174. <i:Interaction.Triggers>
  175. <i:EventTrigger EventName="Checked">
  176. <i:InvokeCommandAction Command="{Binding ListModeCheckedCommand}" CommandParameter="{Binding ElementName=BtnListMode, Path=Tag}" />
  177. </i:EventTrigger>
  178. </i:Interaction.Triggers>
  179. </RadioButton>
  180. </StackPanel>
  181. </Border>
  182. <Separator
  183. Width="1"
  184. Height="16"
  185. Margin="1,0,1,0"
  186. BorderBrush="#1A000000"
  187. BorderThickness="1" />
  188. <Button
  189. x:Name="BtnDelete"
  190. Width="32"
  191. Height="32"
  192. MaxHeight="40"
  193. Margin="16,0,0,0"
  194. Padding="0,0,0,0"
  195. Command="{Binding RemoveFilesFromContainerCommand}"
  196. Foreground="#6B6F7D"
  197. IsEnabled="{Binding IsEmpty, Converter={StaticResource InvertBoolConvert}, Mode=OneWay}">
  198. <Path
  199. Width="32"
  200. Height="32"
  201. Data="M14 9.75H18V8.25H14V9.75ZM9 12.25H10.25V23C10.25 23.4142 10.5858 23.75 11 23.75H21C21.4142 23.75 21.75 23.4142 21.75 23V12.25H23V10.75H9V12.25ZM11.75 22.25V12.25H20.25V22.25H11.75ZM15.25 14.5V19.5H16.75V14.5H15.25Z"
  202. Fill="{Binding ElementName=BtnDelete, Path=Foreground}" />
  203. <Button.Style>
  204. <Style BasedOn="{StaticResource btn.sec}" TargetType="{x:Type Button}">
  205. <Style.Triggers>
  206. <DataTrigger Binding="{Binding ElementName=RecentFilesList, Path=Visibility}" Value="Visible">
  207. <Setter Property="CommandParameter" Value="{Binding ElementName=RecentFilesList, Path=SelectedItems}" />
  208. </DataTrigger>
  209. <DataTrigger Binding="{Binding ElementName=GridRecentFilesList, Path=Visibility}" Value="Visible">
  210. <Setter Property="CommandParameter" Value="{Binding ElementName=GridRecentFilesList, Path=SelectedItems}" />
  211. </DataTrigger>
  212. </Style.Triggers>
  213. </Style>
  214. </Button.Style>
  215. </Button>
  216. </StackPanel>
  217. </Grid>
  218. <Grid Grid.Row="2" Visibility="{Binding IsEmpty, Converter={StaticResource InvertBoolToVisibleConvert}}">
  219. <Grid.ColumnDefinitions>
  220. <ColumnDefinition Width="799*" />
  221. <ColumnDefinition Width="*" />
  222. </Grid.ColumnDefinitions>
  223. <Border Visibility="{Binding IsListMode, Converter={StaticResource BoolToVisible}}">
  224. <ListView
  225. x:Name="RecentFilesList"
  226. Grid.ColumnSpan="2"
  227. MinWidth="380"
  228. MinHeight="216"
  229. Margin="32,0,0,0"
  230. Padding="0,0,0,0"
  231. Background="Transparent"
  232. BorderThickness="0"
  233. ItemContainerStyle="{StaticResource SubFilesListViewItemStyle}"
  234. ItemTemplate="{StaticResource listviewItem}"
  235. ItemsPanel="{StaticResource listPanel}"
  236. ItemsSource="{Binding RecentFilesGroup}"
  237. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  238. ScrollViewer.VerticalScrollBarVisibility="Auto"
  239. SelectionMode="Extended"
  240. Style="{StaticResource FilesListViewStyle}"
  241. VirtualizingPanel.CacheLength="1"
  242. VirtualizingPanel.CacheLengthUnit="Page"
  243. VirtualizingPanel.IsVirtualizing="True"
  244. VirtualizingPanel.ScrollUnit="Pixel" />
  245. </Border>
  246. <ListView
  247. x:Name="GridRecentFilesList"
  248. Grid.ColumnSpan="2"
  249. MinWidth="380"
  250. MinHeight="216"
  251. Margin="32,0,0,0"
  252. Padding="0,0,0,0"
  253. Background="Transparent"
  254. BorderThickness="0"
  255. ItemContainerStyle="{StaticResource HomeGridViewItemStyle}"
  256. ItemTemplate="{StaticResource gridviewItem}"
  257. ItemsPanel="{StaticResource gridPanel}"
  258. ItemsSource="{Binding RecentFilesGroup}"
  259. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  260. ScrollViewer.VerticalScrollBarVisibility="Auto"
  261. SelectionMode="Extended"
  262. Style="{StaticResource FilesGridViewStyle}"
  263. VirtualizingPanel.CacheLength="1"
  264. VirtualizingPanel.CacheLengthUnit="Page"
  265. VirtualizingPanel.IsVirtualizing="True"
  266. VirtualizingPanel.ScrollUnit="Pixel"
  267. Visibility="{Binding IsListMode, Converter={StaticResource InvertBoolToVisibleConvert}}" />
  268. </Grid>
  269. <StackPanel
  270. x:Name="BlankContentPanel"
  271. Grid.Row="1"
  272. Grid.RowSpan="2"
  273. HorizontalAlignment="Center"
  274. VerticalAlignment="Center"
  275. Visibility="{Binding IsEmpty, Converter={StaticResource BoolToVisible}}">
  276. <Button
  277. x:Name="BtnAddFiles"
  278. Width="128"
  279. Height="128"
  280. MaxHeight="128"
  281. Background="Transparent"
  282. BorderThickness="0"
  283. Command="{Binding OpenFilesCommand}"
  284. Foreground="#6B6F7D"
  285. Style="{StaticResource OnlyContentBtn}">
  286. <Grid Width="128" Height="128">
  287. <Rectangle
  288. Width="90"
  289. Height="112"
  290. RadiusX="2"
  291. RadiusY="4"
  292. Stroke="{StaticResource color.icon.base.neutral.norm.lv2}"
  293. StrokeDashArray="6 6"
  294. StrokeThickness="2" />
  295. <Path Data="M62.3333 65.6667V79H65.6667V65.6667H79V62.3333H65.6667V49H62.3333V62.3333H49V65.6667H62.3333Z" Fill="{StaticResource color.icon.base.neutral.norm.lv2}" />
  296. <!--<Image
  297. Width="128"
  298. Height="128"
  299. VerticalAlignment="Center"
  300. Source="../../../Resources/HomeIcon/add.png"
  301. Stretch="Uniform" />-->
  302. </Grid>
  303. </Button>
  304. <TextBlock
  305. x:Name="NoFilesText"
  306. HorizontalAlignment="Center"
  307. FontFamily="Segoe UI"
  308. FontSize="16"
  309. Foreground="{StaticResource color.sys.text.neutral.lv2}"
  310. LineHeight="22"
  311. Text="{Binding T_NoFilesTitle}"
  312. TextAlignment="Center" />
  313. <StackPanel Margin="0,12,0,0" Orientation="Horizontal">
  314. <TextBlock
  315. x:Name="clickFileText"
  316. VerticalAlignment="Center"
  317. FontSize="14"
  318. Foreground="#FF999999"
  319. Text="{Binding T_NoFilesContent}" />
  320. </StackPanel>
  321. </StackPanel>
  322. </Grid>
  323. </Grid>
  324. </UserControl>