BookmarkContent.xaml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <UserControl
  2. x:Class="PDF_Office.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_Office.CustomControl"
  6. xmlns:bota="clr-namespace:PDF_Office.ViewModels.BOTA"
  7. xmlns:convert="clr-namespace:PDF_Office.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_Office.Helper"
  11. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  12. xmlns:local="clr-namespace:PDF_Office.Views.BOTA"
  13. xmlns:mainPageLoader="clr-namespace:PDF_Office.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. Text="{Binding Title}"
  82. Visibility="Visible" />
  83. </Grid>
  84. </StackPanel>
  85. </DataTemplate>
  86. <ContextMenu
  87. x:Key="ContextMenu"
  88. DataContext="{Binding PlacementTarget.Tag, RelativeSource={RelativeSource Self}}"
  89. FontSize="14">
  90. <MenuItem
  91. Click="MenuItemRename_Click"
  92. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.DataContext}"
  93. Header="{x:Static mainPageLoader:MainPage.Bookmark_Rename}" />
  94. <MenuItem
  95. Command="{Binding DataContext.EditPageIndexCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
  96. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.DataContext}"
  97. Header="{x:Static mainPageLoader:MainPage.Bookmark_Change}" />
  98. <MenuItem Click="MenuItemDeleteCommand_Click" Header="{x:Static mainPageLoader:MainPage.Bookmark_Delete}" />
  99. </ContextMenu>
  100. </ResourceDictionary>
  101. </UserControl.Resources>
  102. <Grid Background="{StaticResource color.sys.layout.mg}">
  103. <Grid.RowDefinitions>
  104. <RowDefinition Height="48" />
  105. <RowDefinition />
  106. </Grid.RowDefinitions>
  107. <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="0,0,0,1">
  108. <Grid MinWidth="190">
  109. <TextBlock
  110. x:Name="TxtTitle"
  111. Margin="16,0,0,0"
  112. HorizontalAlignment="Left"
  113. VerticalAlignment="Center"
  114. FontFamily="Segoe UI"
  115. FontSize="14"
  116. FontWeight="SemiBold"
  117. Foreground="{StaticResource color.sys.text.neutral.lv1}"
  118. Text="Bookmarks" />
  119. <Button
  120. Name="BtnAddBookmark"
  121. Width="40"
  122. Height="40"
  123. Margin="0,0,0,0"
  124. HorizontalAlignment="Right"
  125. Click="BtnAddBookmark_Click"
  126. Style="{StaticResource PageEditToolBtn}">
  127. <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">
  128. <Path.RenderTransform>
  129. <TransformGroup>
  130. <TranslateTransform Y="-3" />
  131. </TransformGroup>
  132. </Path.RenderTransform>
  133. </Path>
  134. </Button>
  135. </Grid>
  136. </Border>
  137. <Grid Grid.Row="1">
  138. <ListView
  139. Name="BookMarkListView"
  140. HorizontalContentAlignment="Stretch"
  141. Background="{StaticResource color.sys.layout.mg}"
  142. BorderThickness="0"
  143. ItemTemplate="{StaticResource myDataTemplate}"
  144. ItemsSource="{Binding Bookmarklist}"
  145. PreviewMouseDown="BookMarkListView_PreviewMouseDown"
  146. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  147. SelectionChanged="BookMarkListView_SelectionChanged"
  148. VirtualizingPanel.CacheLength="1"
  149. VirtualizingPanel.CacheLengthUnit="Page"
  150. VirtualizingPanel.IsVirtualizing="True"
  151. VirtualizingPanel.ScrollUnit="Pixel">
  152. <ListView.ItemsPanel>
  153. <ItemsPanelTemplate>
  154. <VirtualizingStackPanel Margin="-5,0,0,0" Background="Transparent" />
  155. </ItemsPanelTemplate>
  156. </ListView.ItemsPanel>
  157. <ListView.ItemContainerStyle>
  158. <Style BasedOn="{StaticResource ListViewItemGraySelectStyle}" TargetType="ListViewItem">
  159. <EventSetter Event="PreviewMouseDown" Handler="ListViewItem_MouseButtonDown" />
  160. <EventSetter Event="LostFocus" Handler="ListViewItem_LostFocus" />
  161. <Setter Property="ContextMenu" Value="{StaticResource ContextMenu}" />
  162. </Style>
  163. </ListView.ItemContainerStyle>
  164. </ListView>
  165. </Grid>
  166. <StackPanel
  167. Name="EmptyPanel"
  168. Grid.RowSpan="2"
  169. Width="150"
  170. VerticalAlignment="Center"
  171. Visibility="{Binding IsEmptyPanelVisibility}">
  172. <Image
  173. Width="128"
  174. Height="128"
  175. Source="pack://application:,,,/Resources/BOTA/empty_bookmark.png" />
  176. <TextBlock
  177. Name="txtEmpty"
  178. Margin="0,12,0,0"
  179. FontFamily="Segoe UI"
  180. FontSize="14"
  181. Foreground="{StaticResource color.sys.text.neutral.lv2}"
  182. Text="{Binding T_EmptyTitle}"
  183. TextAlignment="Center" />
  184. <TextBlock
  185. Name="txtEmpty2"
  186. Margin="0,12,0,0"
  187. FontFamily="Segoe UI"
  188. FontSize="14"
  189. Foreground="{StaticResource color.sys.text.neutral.lv3}"
  190. Text="{Binding T_EmptyContext}"
  191. TextAlignment="Center"
  192. TextWrapping="Wrap" />
  193. </StackPanel>
  194. </Grid>
  195. </UserControl>