BookmarkContent.xaml 10.0 KB

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