BookmarkContent.xaml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <UserControl
  2. x:Class="PDF_Master.Views.BOTA.BookmarkContent"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:CustomControl="clr-namespace:PDF_Master.CustomControl"
  6. xmlns:bota="clr-namespace:PDF_Master.ViewModels.BOTA"
  7. xmlns:convert="clr-namespace:PDF_Master.DataConvert"
  8. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  9. xmlns:data="clr-namespace:ComPDFKit.PDFDocument;assembly=ComPDFKit.Desk"
  10. xmlns:helper="clr-namespace:PDF_Master.Helper"
  11. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  12. xmlns:local="clr-namespace:PDF_Master.Views.BOTA"
  13. xmlns:mainPageLoader="clr-namespace:PDF_Master.Strings.MainPage"
  14. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  15. xmlns:prism="http://prismlibrary.com/"
  16. d:DataContext="{d:DesignInstance Type=bota:BookmarkContentViewModel}"
  17. d:DesignHeight="450"
  18. d:DesignWidth="300"
  19. prism:ViewModelLocator.AutoWireViewModel="True"
  20. mc:Ignorable="d">
  21. <UserControl.Resources>
  22. <ResourceDictionary>
  23. <ResourceDictionary.MergedDictionaries>
  24. <ResourceDictionary Source="pack://application:,,,/Styles/ListViewStyle.xaml" />
  25. <ResourceDictionary Source="pack://application:,,,/Styles/ButtonStyle.xaml" />
  26. </ResourceDictionary.MergedDictionaries>
  27. <convert:BoolToVisible x:Key="BoolToVisibleConvert" />
  28. <convert:UnVisivleConvert x:Key="UnVisivleConvert" />
  29. <convert:ObjectConvert x:Key="ObjectConvert" />
  30. <DataTemplate x:Key="myDataTemplate" DataType="{x:Type data:CPDFBookmark}">
  31. <StackPanel
  32. Name="StackPanel"
  33. HorizontalAlignment="Stretch"
  34. VerticalAlignment="Stretch">
  35. <Grid Name="Grid" Margin="15,5">
  36. <Grid.ColumnDefinitions>
  37. <ColumnDefinition Width="10*" />
  38. <ColumnDefinition Width="90*" />
  39. </Grid.ColumnDefinitions>
  40. <!--<Image
  41. Grid.Column="0"
  42. Width="16"
  43. Height="16"
  44. Source="pack://application:,,,/Resources/BOTA/empty_bookmark.png" />-->
  45. <Path
  46. Grid.Column="0"
  47. Width="16"
  48. Height="16"
  49. Data="M3 3.47368C3 2.65979 3.65979 2 4.47368 2H11.5263C12.3402 2 13 2.65979 13 3.47368V14.3044C13 14.9486 12.2314 15.2826 11.7604 14.843L8.50276 11.8026C8.21966 11.5384 7.78034 11.5384 7.49724 11.8026L4.2396 14.843C3.7686 15.2826 3 14.9486 3 14.3044V3.47368Z"
  50. Fill="#94989C">
  51. <Path.RenderTransform>
  52. <TransformGroup>
  53. <TranslateTransform Y="-3" />
  54. </TransformGroup>
  55. </Path.RenderTransform>
  56. </Path>
  57. <Grid Grid.Column="1" Visibility="{Binding ElementName=TxbTitle, Path=Visibility, Mode=TwoWay, Converter={StaticResource UnVisivleConvert}}">
  58. <TextBox
  59. x:Name="TxtTitleInput"
  60. Padding="5"
  61. HorizontalContentAlignment="Left"
  62. Background="White"
  63. BorderThickness="1"
  64. FontSize="14"
  65. Style="{StaticResource TextBoxStyleRadius}"
  66. Text="{Binding Title}"
  67. TextWrapping="Wrap">
  68. <i:Interaction.Triggers>
  69. <i:EventTrigger EventName="KeyDown">
  70. <i:InvokeCommandAction Command="{Binding DataContext.KeyDownCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True" />
  71. </i:EventTrigger>
  72. </i:Interaction.Triggers>
  73. </TextBox>
  74. </Grid>
  75. <TextBlock
  76. Name="TxbTitle"
  77. Grid.Column="1"
  78. Padding="5"
  79. Background="Transparent"
  80. FontSize="14"
  81. TextWrapping="Wrap"
  82. Text="{Binding Title}"
  83. Visibility="Visible" />
  84. </Grid>
  85. </StackPanel>
  86. </DataTemplate>
  87. <ContextMenu
  88. x:Key="ContextMenu"
  89. DataContext="{Binding PlacementTarget.Tag, RelativeSource={RelativeSource Self}}"
  90. FontSize="14">
  91. <MenuItem
  92. Click="MenuItemRename_Click"
  93. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.DataContext}"
  94. Header="{x:Static mainPageLoader:MainPage.Bookmark_Rename}" />
  95. <MenuItem
  96. Command="{Binding DataContext.EditPageIndexCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
  97. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.DataContext}"
  98. Header="{x:Static mainPageLoader:MainPage.Bookmark_Change}" />
  99. <MenuItem Click="MenuItemDeleteCommand_Click" Header="{x:Static mainPageLoader:MainPage.Bookmark_Delete}" />
  100. </ContextMenu>
  101. </ResourceDictionary>
  102. </UserControl.Resources>
  103. <Grid Background="{StaticResource color.sys.layout.mg}">
  104. <Grid.RowDefinitions>
  105. <RowDefinition Height="48" />
  106. <RowDefinition />
  107. </Grid.RowDefinitions>
  108. <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="0,0,0,1">
  109. <Grid MinWidth="190">
  110. <TextBlock
  111. x:Name="TxtTitle"
  112. Margin="16,0,0,0"
  113. HorizontalAlignment="Left"
  114. VerticalAlignment="Center"
  115. FontFamily="Segoe UI"
  116. FontSize="14"
  117. FontWeight="SemiBold"
  118. Foreground="{StaticResource color.sys.text.neutral.lv1}"
  119. Text="Bookmarks" />
  120. <Button
  121. Name="BtnAddBookmark"
  122. Width="40"
  123. Height="40"
  124. Margin="0,0,0,0"
  125. HorizontalAlignment="Right"
  126. Click="BtnAddBookmark_Click"
  127. Style="{StaticResource PageEditToolBtn}">
  128. <Path Data="M13.5 8C13.5 11.0376 11.0376 13.5 8 13.5C4.96243 13.5 2.5 11.0376 2.5 8C2.5 4.96243 4.96243 2.5 8 2.5C11.0376 2.5 13.5 4.96243 13.5 8ZM15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM7.25005 4.80003V7.25003H4.80005V8.75003H7.25005V11.2H8.75005V8.75003H11.2V7.25003H8.75005V4.80003H7.25005Z" Fill="#616469">
  129. <Path.RenderTransform>
  130. <TransformGroup>
  131. <TranslateTransform Y="-3" />
  132. </TransformGroup>
  133. </Path.RenderTransform>
  134. </Path>
  135. </Button>
  136. </Grid>
  137. </Border>
  138. <Grid Grid.Row="1">
  139. <ListView
  140. Name="BookMarkListView"
  141. HorizontalContentAlignment="Stretch"
  142. Background="{StaticResource color.sys.layout.mg}"
  143. BorderThickness="0"
  144. ItemTemplate="{StaticResource myDataTemplate}"
  145. ItemsSource="{Binding Bookmarklist}"
  146. PreviewMouseDown="BookMarkListView_PreviewMouseDown"
  147. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  148. SelectionChanged="BookMarkListView_SelectionChanged"
  149. VirtualizingPanel.CacheLength="1"
  150. VirtualizingPanel.CacheLengthUnit="Page"
  151. VirtualizingPanel.IsVirtualizing="True"
  152. VirtualizingPanel.ScrollUnit="Pixel">
  153. <ListView.ItemsPanel>
  154. <ItemsPanelTemplate>
  155. <VirtualizingStackPanel Margin="-5,0,0,0" Background="Transparent" />
  156. </ItemsPanelTemplate>
  157. </ListView.ItemsPanel>
  158. <ListView.ItemContainerStyle>
  159. <Style BasedOn="{StaticResource ListViewItemGraySelectStyle}" TargetType="ListViewItem">
  160. <EventSetter Event="PreviewMouseDown" Handler="ListViewItem_MouseButtonDown" />
  161. <EventSetter Event="LostFocus" Handler="ListViewItem_LostFocus" />
  162. <Setter Property="ContextMenu" Value="{StaticResource ContextMenu}" />
  163. </Style>
  164. </ListView.ItemContainerStyle>
  165. </ListView>
  166. </Grid>
  167. <StackPanel
  168. Name="EmptyPanel"
  169. Grid.RowSpan="2"
  170. Width="150"
  171. VerticalAlignment="Center"
  172. Visibility="{Binding IsEmptyPanelVisibility}">
  173. <Image
  174. Width="128"
  175. Height="128"
  176. Source="pack://application:,,,/Resources/BOTA/empty_bookmark.png" />
  177. <TextBlock
  178. Name="txtEmpty"
  179. Margin="0,12,0,0"
  180. FontFamily="Segoe UI"
  181. FontSize="14"
  182. Foreground="{StaticResource color.sys.text.neutral.lv2}"
  183. Text="{Binding T_EmptyTitle}"
  184. TextAlignment="Center" />
  185. <TextBlock
  186. Name="txtEmpty2"
  187. Margin="0,12,0,0"
  188. FontFamily="Segoe UI"
  189. FontSize="14"
  190. Foreground="{StaticResource color.sys.text.neutral.lv3}"
  191. Text="{Binding T_EmptyContext}"
  192. TextAlignment="Center"
  193. TextWrapping="Wrap" />
  194. </StackPanel>
  195. </Grid>
  196. </UserControl>