BookmarkContent.xaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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:bota="clr-namespace:PDF_Office.ViewModels.BOTA"
  6. xmlns:convert="clr-namespace:PDF_Office.DataConvert"
  7. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  8. xmlns:data="clr-namespace:ComPDFKit.PDFDocument;assembly=ComPDFKit.Desk"
  9. xmlns:helper="clr-namespace:PDF_Office.Helper"
  10. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  11. xmlns:local="clr-namespace:PDF_Office.Views.BOTA"
  12. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  13. xmlns:prism="http://prismlibrary.com/"
  14. d:DataContext="{d:DesignInstance Type=bota:BookmarkContentViewModel}"
  15. d:DesignHeight="450"
  16. d:DesignWidth="300"
  17. prism:ViewModelLocator.AutoWireViewModel="True"
  18. mc:Ignorable="d">
  19. <UserControl.Resources>
  20. <ResourceDictionary>
  21. <ResourceDictionary.MergedDictionaries>
  22. <ResourceDictionary Source="/Styles/ListViewStyle.xaml" />
  23. </ResourceDictionary.MergedDictionaries>
  24. <convert:BoolToVisible x:Key="BoolToVisibleConvert" />
  25. <convert:UnVisivleConvert x:Key="UnVisivleConvert" />
  26. </ResourceDictionary>
  27. </UserControl.Resources>
  28. <Grid Background="#F2F2F2">
  29. <Grid.RowDefinitions>
  30. <RowDefinition Height="40" />
  31. <RowDefinition />
  32. </Grid.RowDefinitions>
  33. <Grid MinWidth="190">
  34. <TextBlock
  35. x:Name="TxtTitle"
  36. Margin="12,0,0,0"
  37. HorizontalAlignment="Left"
  38. VerticalAlignment="Center"
  39. FontSize="18"
  40. FontWeight="SemiBold"
  41. Text="Bookmarks" />
  42. <Button
  43. Name="BtnAddBookmark"
  44. Width="40"
  45. Height="40"
  46. Margin="0,0,0,0"
  47. HorizontalAlignment="Right"
  48. Content="添加" Command="{Binding AddBookmarkCommand}">
  49. </Button>
  50. </Grid>
  51. <Grid Grid.Row="1">
  52. <ListView
  53. Name="BookMarkListView"
  54. HorizontalContentAlignment="Stretch"
  55. Background="#F2F2F2"
  56. BorderThickness="0"
  57. ItemsSource="{Binding Bookmarklist}"
  58. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  59. VirtualizingPanel.CacheLength="1"
  60. VirtualizingPanel.CacheLengthUnit="Page"
  61. VirtualizingPanel.IsVirtualizing="True"
  62. VirtualizingPanel.ScrollUnit="Pixel">
  63. <ListView.ItemsPanel>
  64. <ItemsPanelTemplate>
  65. <VirtualizingStackPanel Margin="-5,0,0,0" Background="Transparent" />
  66. </ItemsPanelTemplate>
  67. </ListView.ItemsPanel>
  68. <ListView.ItemTemplate>
  69. <DataTemplate DataType="{x:Type data:CPDFBookmark}">
  70. <Grid
  71. Name="itemGrid"
  72. HorizontalAlignment="Stretch"
  73. VerticalAlignment="Stretch"
  74. Background="#F2F2F2">
  75. <Grid.RowDefinitions>
  76. <RowDefinition Height="40" />
  77. </Grid.RowDefinitions>
  78. <StackPanel Name="StackPanel" Margin="15,5">
  79. <!-- IsHitTestVisible="False" -->
  80. <TextBlock
  81. Name="TextBlockTitle"
  82. Padding="5"
  83. Background="Transparent"
  84. FontSize="14"
  85. Text="{Binding Title}"
  86. Visibility="Visible" />
  87. <TextBox
  88. Name="TitleInput"
  89. Padding="5"
  90. Background="White"
  91. BorderThickness="1"
  92. FontSize="14"
  93. IsVisibleChanged="TitleInput_IsVisibleChanged"
  94. Text="{Binding Title}"
  95. TextWrapping="Wrap"
  96. Visibility="{Binding ElementName=TextBlockTitle, Path=Visibility, Converter={StaticResource UnVisivleConvert}, Mode=TwoWay}">
  97. <i:Interaction.Triggers>
  98. <i:EventTrigger EventName="LostFocus">
  99. <i:InvokeCommandAction Command="{Binding DataContext.LostFocusCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True" />
  100. </i:EventTrigger>
  101. <i:EventTrigger EventName="GotFocus">
  102. <i:InvokeCommandAction Command="{Binding DataContext.GotFocusCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True" />
  103. </i:EventTrigger>
  104. <i:EventTrigger EventName="MouseEnter">
  105. <i:InvokeCommandAction Command="{Binding DataContext.MouseEnterCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True" />
  106. </i:EventTrigger>
  107. </i:Interaction.Triggers>
  108. <!--<TextBox.Resources>
  109. <Style TargetType="{x:Type Border}">
  110. <Setter Property="CornerRadius" Value="2" />
  111. <Setter Property="BorderThickness" Value="1" />
  112. <Setter Property="BorderBrush" Value="#000000" />
  113. </Style>
  114. </TextBox.Resources>-->
  115. <!--<i:Interaction.Triggers>
  116. <i:EventTrigger EventName="MouseDoubleClick">
  117. <helper:SetterAction>
  118. <helper:SetterAction.Setters>
  119. <Setter Property="TextBox.IsReadOnly" Value="False" />
  120. <Setter Property="TextBox.Background" Value="#FFFFFF" />
  121. <Setter Property="TextBox.BorderBrush" Value="#000000" />
  122. <Setter Property="TextBox.BorderThickness" Value="1px" />
  123. </helper:SetterAction.Setters>
  124. </helper:SetterAction>
  125. </i:EventTrigger>
  126. <i:EventTrigger EventName="MouseEnter">
  127. <i:EventTrigger.Actions>
  128. <helper:SetterAction>
  129. <helper:SetterAction.Setters>
  130. <Setter Property="TextBox.IsReadOnly" Value="true" />
  131. <Setter Property="TextBox.Background" Value="Transparent" />
  132. <Setter Property="TextBox.BorderBrush" Value="Transparent" />
  133. <Setter Property="TextBox.BorderThickness" Value="0px" />
  134. </helper:SetterAction.Setters>
  135. </helper:SetterAction>
  136. </i:EventTrigger.Actions>
  137. </i:EventTrigger>
  138. <i:EventTrigger EventName="MouseLeave">
  139. <i:EventTrigger.Actions>
  140. <helper:SetterAction>
  141. <helper:SetterAction.Setters>
  142. <Setter Property="TextBox.IsReadOnly" Value="true" />
  143. <Setter Property="TextBox.Background" Value="Transparent" />
  144. <Setter Property="TextBox.BorderBrush" Value="Transparent" />
  145. <Setter Property="TextBox.BorderThickness" Value="0px" />
  146. </helper:SetterAction.Setters>
  147. </helper:SetterAction>
  148. </i:EventTrigger.Actions>
  149. </i:EventTrigger>
  150. <i:EventTrigger EventName="LostFocus">
  151. <i:EventTrigger.Actions>
  152. <helper:SetterAction>
  153. <helper:SetterAction.Setters>
  154. <Setter Property="TextBox.IsReadOnly" Value="true" />
  155. <Setter Property="TextBox.Background" Value="Transparent" />
  156. <Setter Property="TextBox.BorderBrush" Value="Transparent" />
  157. <Setter Property="TextBox.BorderThickness" Value="0px" />
  158. </helper:SetterAction.Setters>
  159. </helper:SetterAction>
  160. </i:EventTrigger.Actions>
  161. </i:EventTrigger>
  162. </i:Interaction.Triggers>-->
  163. </TextBox>
  164. </StackPanel>
  165. <i:Interaction.Triggers>
  166. <i:EventTrigger EventName="MouseDown">
  167. <i:InvokeCommandAction Command="{Binding DataContext.MouseClickCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True" />
  168. </i:EventTrigger>
  169. <i:EventTrigger EventName="MouseEnter">
  170. <i:InvokeCommandAction Command="{Binding DataContext.MouseEnterCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True" />
  171. </i:EventTrigger>
  172. <i:EventTrigger EventName="MouseMove">
  173. <i:InvokeCommandAction Command="{Binding DataContext.MouseMoveCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True" />
  174. </i:EventTrigger>
  175. <!--<i:EventTrigger EventName="LostFocus">
  176. <i:InvokeCommandAction Command="{Binding DataContext.LostFocusCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True" />
  177. </i:EventTrigger>-->
  178. </i:Interaction.Triggers>
  179. </Grid>
  180. </DataTemplate>
  181. </ListView.ItemTemplate>
  182. <ListView.ItemContainerStyle>
  183. <Style BasedOn="{StaticResource ListViewItemGraySelectStyle}" TargetType="ListViewItem">
  184. <!--<EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListViewItem_PreviewMouseLeftButtonDown" />
  185. <EventSetter Event="Unselected" Handler="ListViewItem_Unselected" />-->
  186. </Style>
  187. </ListView.ItemContainerStyle>
  188. </ListView>
  189. </Grid>
  190. <StackPanel
  191. Name="EmptyPanel"
  192. Grid.RowSpan="2"
  193. Width="150"
  194. VerticalAlignment="Center"
  195. Visibility="{Binding IsEmptyPanelVisibility}">
  196. <Image
  197. Width="140"
  198. Height="140"
  199. Source="\Resources\BOTA\empty_bookmark.png" />
  200. <TextBlock
  201. Name="txtEmpty"
  202. Margin="0,12,0,0"
  203. FontFamily="Segoe UI"
  204. FontSize="16"
  205. Text="No bookmark"
  206. TextAlignment="Center" />
  207. </StackPanel>
  208. </Grid>
  209. </UserControl>