RecentFilesContent.xaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <UserControl
  2. x:Class="PDF_Master.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_Master.DataConvert"
  6. xmlns:customControl="clr-namespace:PDF_Master.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_Master.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_Master.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. IsVisibleChanged="UserControl_IsVisibleChanged"
  18. KeyDown="UserControl_KeyDown"
  19. Loaded="UserControl_Loaded"
  20. mc:Ignorable="d">
  21. <UserControl.Resources>
  22. <ResourceDictionary>
  23. <ResourceDictionary.MergedDictionaries>
  24. <ResourceDictionary Source="../../../Styles/ListViewStyle.xaml" />
  25. <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml" />
  26. <ResourceDictionary Source="../../../Styles/RadioButtonStyle.xaml" />
  27. <ResourceDictionary Source="../../../Styles/ButtonStyle.xaml" />
  28. </ResourceDictionary.MergedDictionaries>
  29. <DataConvert:BoolToVisible x:Key="BoolToVisible" />
  30. <DataConvert:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert" />
  31. <DataConvert:InvertBoolConvert x:Key="InvertBoolConvert" />
  32. <DataTemplate x:Key="listviewItem">
  33. <local:DocItemListViewControl
  34. HorizontalAlignment="Stretch"
  35. DeleteItemHandler="DocItemListViewControl_DeleteItemHandler"
  36. OpenFileItemHandler="DocItemListViewControl_OpenFileItemHandler" />
  37. </DataTemplate>
  38. <DataTemplate x:Key="gridviewItem">
  39. <local:DocItemControl HorizontalAlignment="Stretch" />
  40. </DataTemplate>
  41. <ItemsPanelTemplate x:Key="listPanel">
  42. <StackPanel Margin="0,-22,0,0" Orientation="Vertical" />
  43. </ItemsPanelTemplate>
  44. <ItemsPanelTemplate x:Key="gridPanel">
  45. <WrapPanel />
  46. </ItemsPanelTemplate>
  47. <ContextMenu
  48. x:Key="FlyoutMenu"
  49. FontSize="14"
  50. Opened="ContextMenu_Opened">
  51. <MenuItem
  52. Name="FilePathMenuItem"
  53. Click="FilePathMenuItem_Click"
  54. Header="{Binding T_MenuShow}"
  55. IsEnabled="True" />
  56. <MenuItem
  57. Name="MenuOpenFile"
  58. Click="MenuOpenFile_Click"
  59. Header="Open File"
  60. IsEnabled="True"
  61. Visibility="Collapsed" />
  62. <MenuItem
  63. Name="DeleteMenuItem"
  64. Click="DeleteMenuItem_Click"
  65. Header="{Binding T_MenuRemove}"
  66. IsEnabled="True" />
  67. </ContextMenu>
  68. <Style
  69. x:Key="SubFilesListViewItemStyle"
  70. BasedOn="{StaticResource FilesListViewItemStyle}"
  71. TargetType="{x:Type ListViewItem}">
  72. <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}" />
  73. <Setter Property="HorizontalContentAlignment" Value="Center" />
  74. <Setter Property="Height" Value="72" />
  75. <EventSetter Event="PreviewMouseRightButtonDown" Handler="ListViewItem_PreviewMouseRightButtonDown" />
  76. <EventSetter Event="PreviewMouseDoubleClick" Handler="RecentFilesList_PreviewMouseDoubleClick" />
  77. </Style>
  78. <Style
  79. x:Key="HomeGridViewItemStyle"
  80. BasedOn="{StaticResource FilesGridItemStyle}"
  81. TargetType="{x:Type ListViewItem}">
  82. <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}" />
  83. <Setter Property="HorizontalContentAlignment" Value="Center" />
  84. <Setter Property="VerticalContentAlignment" Value="Center" />
  85. <Setter Property="Width" Value="226" />
  86. <Setter Property="Height" Value="248" />
  87. <Setter Property="Padding" Value="0" />
  88. <EventSetter Event="PreviewMouseRightButtonDown" Handler="ListViewItem_PreviewMouseRightButtonDown" />
  89. <EventSetter Event="PreviewMouseDoubleClick" Handler="RecentFilesList_PreviewMouseDoubleClick" />
  90. </Style>
  91. </ResourceDictionary>
  92. </UserControl.Resources>
  93. <Grid>
  94. <Grid>
  95. <Grid.RowDefinitions>
  96. <RowDefinition Height="Auto" />
  97. <RowDefinition Height="Auto" />
  98. <RowDefinition />
  99. </Grid.RowDefinitions>
  100. <Grid x:Name="GridRecentFilesTile">
  101. <TextBlock
  102. x:Name="TxbRecentlyTile"
  103. Margin="0,0,0,0"
  104. Padding="0,6,0,0"
  105. HorizontalAlignment="Left"
  106. FontFamily="Segoe UI"
  107. FontSize="20"
  108. FontWeight="Semibold"
  109. Text="{Binding T_Title}" />
  110. <StackPanel
  111. x:Name="PnlRightBtns"
  112. Grid.Column="0"
  113. Grid.ColumnSpan="2"
  114. Margin="0,0,0,0"
  115. HorizontalAlignment="Right"
  116. Orientation="Horizontal">
  117. <Border
  118. Height="32"
  119. Padding="2"
  120. Background="{StaticResource color.sys.layout.fg.dark}"
  121. CornerRadius="4">
  122. <StackPanel Orientation="Horizontal">
  123. <RadioButton
  124. x:Name="BtnGridMode"
  125. Width="32"
  126. Height="28"
  127. Padding="0"
  128. HorizontalContentAlignment="Center"
  129. VerticalContentAlignment="Center"
  130. GroupName="Mode"
  131. IsChecked="{Binding IsListMode, Converter={StaticResource InvertBoolConvert}, Mode=OneTime}"
  132. Style="{StaticResource ListModeRadioBtnStyle}"
  133. Tag="GridMode">
  134. <Path
  135. Width="32"
  136. Height="28"
  137. HorizontalAlignment="Center"
  138. VerticalAlignment="Center"
  139. 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"
  140. Fill="{Binding ElementName=BtnGridMode, Path=Foreground}" />
  141. <i:Interaction.Triggers>
  142. <i:EventTrigger EventName="Checked">
  143. <i:InvokeCommandAction Command="{Binding ListModeCheckedCommand}" CommandParameter="{Binding ElementName=BtnGridMode, Path=Tag}" />
  144. </i:EventTrigger>
  145. </i:Interaction.Triggers>
  146. </RadioButton>
  147. <RadioButton
  148. x:Name="BtnListMode"
  149. Width="32"
  150. Height="28"
  151. Padding="0"
  152. HorizontalContentAlignment="Center"
  153. VerticalContentAlignment="Center"
  154. GroupName="Mode"
  155. IsChecked="{Binding IsListMode, Mode=OneTime}"
  156. Style="{StaticResource ListModeRadioBtnStyle}"
  157. Tag="ListMode">
  158. <Path
  159. Width="16"
  160. Height="16"
  161. Data="M15 3.75H1V2.25H15V3.75ZM15 8.75H1V7.25H15V8.75ZM1 13.75H15V12.25H1V13.75Z"
  162. Fill="{Binding ElementName=BtnListMode, Path=Foreground}" />
  163. <i:Interaction.Triggers>
  164. <i:EventTrigger EventName="Checked">
  165. <i:InvokeCommandAction Command="{Binding ListModeCheckedCommand}" CommandParameter="{Binding ElementName=BtnListMode, Path=Tag}" />
  166. </i:EventTrigger>
  167. </i:Interaction.Triggers>
  168. </RadioButton>
  169. </StackPanel>
  170. </Border>
  171. <Separator
  172. Width="1"
  173. Height="16"
  174. Margin="1,0,1,0"
  175. BorderBrush="#1A000000"
  176. BorderThickness="1" />
  177. <Button
  178. x:Name="BtnDelete"
  179. Width="32"
  180. Height="32"
  181. MaxHeight="40"
  182. Margin="16,0,0,0"
  183. Padding="0,0,0,0"
  184. Command="{Binding RemoveFilesFromContainerCommand}"
  185. Foreground="#6B6F7D"
  186. IsEnabled="{Binding IsEmpty, Converter={StaticResource InvertBoolConvert}, Mode=OneWay}">
  187. <Path
  188. Width="32"
  189. Height="32"
  190. 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"
  191. Fill="{Binding ElementName=BtnDelete, Path=Foreground}" />
  192. <Button.Style>
  193. <Style BasedOn="{StaticResource btn.sec}" TargetType="{x:Type Button}">
  194. <Style.Triggers>
  195. <DataTrigger Binding="{Binding ElementName=RecentFilesList, Path=Visibility}" Value="Visible">
  196. <Setter Property="CommandParameter" Value="{Binding ElementName=RecentFilesList, Path=SelectedItems}" />
  197. </DataTrigger>
  198. <DataTrigger Binding="{Binding ElementName=GridRecentFilesList, Path=Visibility}" Value="Visible">
  199. <Setter Property="CommandParameter" Value="{Binding ElementName=GridRecentFilesList, Path=SelectedItems}" />
  200. </DataTrigger>
  201. </Style.Triggers>
  202. </Style>
  203. </Button.Style>
  204. </Button>
  205. </StackPanel>
  206. </Grid>
  207. <Grid
  208. Grid.Row="2"
  209. Margin="0,16,0,0"
  210. Visibility="{Binding IsEmpty, Converter={StaticResource InvertBoolToVisibleConvert}}">
  211. <Grid.ColumnDefinitions>
  212. <ColumnDefinition Width="799*" />
  213. <ColumnDefinition Width="*" />
  214. </Grid.ColumnDefinitions>
  215. <Border Visibility="{Binding IsListMode, Converter={StaticResource BoolToVisible}}">
  216. <ListView
  217. x:Name="RecentFilesList"
  218. Grid.ColumnSpan="2"
  219. MinWidth="200"
  220. MinHeight="216"
  221. BorderThickness="0"
  222. ItemContainerStyle="{StaticResource SubFilesListViewItemStyle}"
  223. ItemTemplate="{StaticResource listviewItem}"
  224. ItemsPanel="{StaticResource listPanel}"
  225. ItemsSource="{Binding RecentFilesGroup}"
  226. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  227. ScrollViewer.VerticalScrollBarVisibility="Auto"
  228. SelectionMode="Extended"
  229. Style="{StaticResource FilesListViewStyle}"
  230. VirtualizingPanel.CacheLength="1"
  231. VirtualizingPanel.CacheLengthUnit="Page"
  232. VirtualizingPanel.IsVirtualizing="True"
  233. VirtualizingPanel.ScrollUnit="Pixel" />
  234. </Border>
  235. <ListView
  236. x:Name="GridRecentFilesList"
  237. Grid.ColumnSpan="2"
  238. MinWidth="200"
  239. MinHeight="216"
  240. Background="Transparent"
  241. BorderThickness="0"
  242. ItemContainerStyle="{StaticResource HomeGridViewItemStyle}"
  243. ItemTemplate="{StaticResource gridviewItem}"
  244. ItemsPanel="{StaticResource gridPanel}"
  245. ItemsSource="{Binding RecentFilesGroup}"
  246. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  247. ScrollViewer.VerticalScrollBarVisibility="Auto"
  248. SelectionMode="Extended"
  249. VirtualizingPanel.CacheLength="1"
  250. VirtualizingPanel.CacheLengthUnit="Page"
  251. VirtualizingPanel.IsVirtualizing="True"
  252. VirtualizingPanel.ScrollUnit="Pixel"
  253. Visibility="{Binding IsListMode, Converter={StaticResource InvertBoolToVisibleConvert}}" />
  254. </Grid>
  255. <StackPanel
  256. x:Name="BlankContentPanel"
  257. Grid.Row="1"
  258. Grid.RowSpan="2"
  259. HorizontalAlignment="Center"
  260. VerticalAlignment="Center"
  261. Visibility="{Binding IsEmpty, Converter={StaticResource BoolToVisible}}">
  262. <Button
  263. x:Name="BtnAddFiles"
  264. Width="92"
  265. Height="114"
  266. MaxHeight="128"
  267. Background="Transparent"
  268. BorderThickness="0"
  269. Command="{Binding OpenFilesCommand}"
  270. Foreground="#6B6F7D"
  271. Style="{StaticResource OnlyContentBtn}">
  272. <Grid>
  273. <Rectangle
  274. Width="90"
  275. Height="114"
  276. RadiusX="2"
  277. RadiusY="4"
  278. Stroke="{StaticResource color.icon.base.neutral.norm.lv2}"
  279. StrokeDashArray="6 6"
  280. StrokeThickness="2" />
  281. <Path
  282. Width="30"
  283. Height="30"
  284. HorizontalAlignment="Center"
  285. VerticalAlignment="Center"
  286. Data="M13.3333 16.6667V30H16.6667V16.6667H30V13.3333H16.6667V0H13.3333V13.3333H0V16.6667H13.3333Z"
  287. Fill="{StaticResource color.icon.base.neutral.norm.lv2}" />
  288. <!--<Image
  289. Width="128"
  290. Height="128"
  291. VerticalAlignment="Center"
  292. Source="../../../Resources/HomeIcon/add.png"
  293. Stretch="Uniform" />-->
  294. </Grid>
  295. </Button>
  296. <TextBlock
  297. x:Name="NoFilesText"
  298. HorizontalAlignment="Center"
  299. FontFamily="Segoe UI"
  300. FontSize="16"
  301. Foreground="{StaticResource color.sys.text.neutral.lv2}"
  302. LineHeight="22"
  303. Text="{Binding T_NoFilesTitle}"
  304. TextAlignment="Center" />
  305. <StackPanel Margin="0,12,0,0" Orientation="Horizontal">
  306. <TextBlock
  307. x:Name="clickFileText"
  308. VerticalAlignment="Center"
  309. FontSize="14"
  310. Foreground="#FF999999"
  311. Text="{Binding T_NoFilesContent}" />
  312. </StackPanel>
  313. </StackPanel>
  314. </Grid>
  315. </Grid>
  316. </UserControl>