BookmarkContent.xaml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. KeyDown="UserControl_KeyDown"
  21. mc:Ignorable="d">
  22. <UserControl.Resources>
  23. <ResourceDictionary>
  24. <ResourceDictionary.MergedDictionaries>
  25. <ResourceDictionary Source="pack://application:,,,/Styles/ListViewStyle.xaml" />
  26. <ResourceDictionary Source="pack://application:,,,/Styles/ButtonStyle.xaml" />
  27. </ResourceDictionary.MergedDictionaries>
  28. <convert:BoolToVisible x:Key="BoolToVisibleConvert" />
  29. <convert:UnVisivleConvert x:Key="UnVisivleConvert" />
  30. <convert:ObjectConvert x:Key="ObjectConvert" />
  31. <DataTemplate x:Key="myDataTemplate" DataType="{x:Type data:CPDFBookmark}">
  32. <StackPanel
  33. Name="StackPanel"
  34. HorizontalAlignment="Stretch"
  35. VerticalAlignment="Stretch">
  36. <Grid Name="Grid" Margin="15,5">
  37. <Grid.ColumnDefinitions>
  38. <ColumnDefinition Width="10*" />
  39. <ColumnDefinition Width="90*" />
  40. </Grid.ColumnDefinitions>
  41. <!--<Image
  42. Grid.Column="0"
  43. Width="16"
  44. Height="16"
  45. Source="pack://application:,,,/Resources/BOTA/empty_bookmark.png" />-->
  46. <Path
  47. Grid.Column="0"
  48. Width="16"
  49. Height="16"
  50. Margin="0,9,0,0"
  51. VerticalAlignment="Top"
  52. 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"
  53. Fill="#94989C">
  54. <Path.RenderTransform>
  55. <TransformGroup>
  56. <TranslateTransform Y="-3" />
  57. </TransformGroup>
  58. </Path.RenderTransform>
  59. </Path>
  60. <Grid Grid.Column="1" Visibility="{Binding ElementName=TxbTitle, Path=Visibility, Mode=TwoWay, Converter={StaticResource UnVisivleConvert}}">
  61. <TextBox
  62. x:Name="TxtTitleInput"
  63. Padding="5"
  64. HorizontalContentAlignment="Left"
  65. Background="White"
  66. BorderThickness="1"
  67. FontSize="14"
  68. Style="{StaticResource TextBoxStyleRadius}"
  69. Text="{Binding Title}"
  70. TextWrapping="Wrap">
  71. <i:Interaction.Triggers>
  72. <i:EventTrigger EventName="KeyDown">
  73. <i:InvokeCommandAction Command="{Binding DataContext.KeyDownCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True" />
  74. </i:EventTrigger>
  75. </i:Interaction.Triggers>
  76. </TextBox>
  77. </Grid>
  78. <TextBlock
  79. Name="TxbTitle"
  80. Grid.Column="1"
  81. Padding="5"
  82. Background="Transparent"
  83. FontSize="14"
  84. Text="{Binding Title}"
  85. TextWrapping="Wrap"
  86. Visibility="Visible" />
  87. </Grid>
  88. </StackPanel>
  89. </DataTemplate>
  90. </ResourceDictionary>
  91. </UserControl.Resources>
  92. <Grid MinHeight="500" Background="{StaticResource color.sys.layout.mg}">
  93. <Grid.RowDefinitions>
  94. <RowDefinition Height="48" />
  95. <RowDefinition />
  96. </Grid.RowDefinitions>
  97. <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="0,0,0,1">
  98. <Grid MinWidth="190">
  99. <TextBlock
  100. x:Name="TxtTitle"
  101. Margin="16,0,0,0"
  102. HorizontalAlignment="Left"
  103. VerticalAlignment="Center"
  104. FontFamily="Segoe UI"
  105. FontSize="14"
  106. FontWeight="SemiBold"
  107. Foreground="{StaticResource color.sys.text.neutral.lv1}"
  108. Text="Bookmark" />
  109. <Button
  110. Name="BtnAddBookmark"
  111. Width="40"
  112. Height="40"
  113. Margin="0,0,0,0"
  114. HorizontalAlignment="Right"
  115. Click="BtnAddBookmark_Click"
  116. Style="{StaticResource PageEditToolBtn}">
  117. <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">
  118. <Path.RenderTransform>
  119. <TransformGroup>
  120. <TranslateTransform Y="-3" />
  121. </TransformGroup>
  122. </Path.RenderTransform>
  123. </Path>
  124. </Button>
  125. </Grid>
  126. </Border>
  127. <Grid Grid.Row="1">
  128. <!--
  129. VirtualizingPanel.CacheLength="1"
  130. VirtualizingPanel.CacheLengthUnit="Page"
  131. VirtualizingPanel.IsVirtualizing="True"
  132. VirtualizingPanel.ScrollUnit="Pixel"
  133. -->
  134. <ListBox
  135. Name="BookMarkListView"
  136. HorizontalContentAlignment="Stretch"
  137. Background="{StaticResource color.sys.layout.mg}"
  138. BorderThickness="0"
  139. FocusVisualStyle="{x:Null}"
  140. ItemTemplate="{StaticResource myDataTemplate}"
  141. ItemsSource="{Binding Bookmarklist}"
  142. PreviewMouseDown="BookMarkListView_PreviewMouseDown"
  143. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  144. SelectionChanged="BookMarkListView_SelectionChanged"
  145. SelectionMode="Extended">
  146. <ListBox.ContextMenu>
  147. <ContextMenu
  148. x:Name="ContextMenuBook"
  149. FontSize="14"
  150. Visibility="Collapsed">
  151. <MenuItem Click="MenuItemRename_Click" Header="{x:Static mainPageLoader:MainPage.Bookmark_Rename}" />
  152. <MenuItem Click="MenuChangeItem_Click" Header="{x:Static mainPageLoader:MainPage.Bookmark_Change}" />
  153. <MenuItem Click="MenuItemDeleteCommand_Click" Header="{x:Static mainPageLoader:MainPage.Bookmark_Delete}" />
  154. </ContextMenu>
  155. </ListBox.ContextMenu>
  156. <ListBox.ItemsPanel>
  157. <ItemsPanelTemplate>
  158. <VirtualizingStackPanel Margin="-5,0,0,0" Background="Transparent" />
  159. </ItemsPanelTemplate>
  160. </ListBox.ItemsPanel>
  161. <ListBox.ItemContainerStyle>
  162. <Style BasedOn="{StaticResource ListBoxItemGraySelectStyle}" TargetType="ListBoxItem">
  163. <EventSetter Event="PreviewMouseDown" Handler="ListViewItem_MouseButtonDown" />
  164. <EventSetter Event="LostFocus" Handler="ListViewItem_LostFocus" />
  165. <!--<Setter Property="ContextMenu" Value="{StaticResource ContextMenuBook}" />-->
  166. </Style>
  167. </ListBox.ItemContainerStyle>
  168. </ListBox>
  169. </Grid>
  170. <StackPanel
  171. Name="EmptyPanel"
  172. Grid.RowSpan="2"
  173. Width="150"
  174. VerticalAlignment="Center"
  175. Visibility="{Binding IsEmptyPanelVisibility}">
  176. <Image
  177. Width="128"
  178. Height="128"
  179. Source="pack://application:,,,/Resources/BOTA/empty_bookmark.png" />
  180. <TextBlock
  181. Name="txtEmpty"
  182. Margin="0,12,0,0"
  183. FontFamily="Segoe UI"
  184. FontSize="14"
  185. Foreground="{StaticResource color.sys.text.neutral.lv2}"
  186. Text="{Binding T_EmptyTitle}"
  187. TextAlignment="Center" />
  188. <TextBlock
  189. Name="txtEmpty2"
  190. Margin="0,12,0,0"
  191. FontFamily="Segoe UI"
  192. FontSize="14"
  193. Foreground="{StaticResource color.sys.text.neutral.lv3}"
  194. Text="{Binding T_EmptyContext}"
  195. TextAlignment="Center"
  196. TextWrapping="Wrap" />
  197. </StackPanel>
  198. </Grid>
  199. </UserControl>