PageEditContent.xaml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <UserControl
  2. x:Class="PDF_Office.Views.PageEdit.PageEditContent"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:convert="clr-namespace:PDF_Office.DataConvert"
  6. xmlns:cussys="clr-namespace:PDF_Office.CustomControl.SystemControl"
  7. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  8. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  9. xmlns:local="clr-namespace:PDF_Office.Views.PageEdit"
  10. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  11. xmlns:pageedit="clr-namespace:PDF_Office.Model.PageEdit"
  12. xmlns:pageedit1="clr-namespace:PDF_Office.ViewModels.PageEdit"
  13. xmlns:prism="http://prismlibrary.com/"
  14. xmlns:wpftk="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
  15. Name="PageEdit"
  16. d:DataContext="{d:DesignInstance Type=pageedit1:PageEditContentViewModel}"
  17. d:DesignHeight="450"
  18. d:DesignWidth="800"
  19. prism:ViewModelLocator.AutoWireViewModel="True"
  20. IsVisibleChanged="PageEdit_IsVisibleChanged"
  21. mc:Ignorable="d">
  22. <UserControl.Resources>
  23. <ResourceDictionary>
  24. <convert:BoolToVisible x:Key="BoolToVisibleConvert" />
  25. <DataTemplate x:Key="PageEditListBoxItemTemplate" DataType="{x:Type pageedit:PageEditItem}">
  26. <Grid Height="320">
  27. <Border
  28. Name="BdBorder"
  29. Height="auto"
  30. VerticalAlignment="Top"
  31. BorderBrush="Blue"
  32. BorderThickness="0"
  33. CornerRadius="0">
  34. <Grid
  35. Width="208"
  36. Height="294"
  37. Margin="1">
  38. <Image Source="{Binding Image}" />
  39. <Border
  40. Width="10"
  41. Height="10"
  42. Margin="0,10,10,0"
  43. HorizontalAlignment="Right"
  44. VerticalAlignment="Top"
  45. Background="Yellow"
  46. Visibility="{Binding HaveBookMark, Converter={StaticResource BoolToVisibleConvert}}" />
  47. </Grid>
  48. </Border>
  49. <Border
  50. Name="BdPageNum"
  51. Margin="0,4,0,0"
  52. VerticalAlignment="Bottom"
  53. Background="Transparent">
  54. <StackPanel
  55. Name="StkpnlButtom"
  56. Width="auto"
  57. MinWidth="116"
  58. HorizontalAlignment="Center"
  59. Background="Transparent">
  60. <TextBlock
  61. Width="auto"
  62. Height="22"
  63. HorizontalAlignment="Center"
  64. FontSize="14"
  65. Text="{Binding PageNumber}" />
  66. <TextBlock
  67. Width="auto"
  68. Height="22"
  69. HorizontalAlignment="Center"
  70. FontSize="14"
  71. Text="{Binding PageSize}"
  72. Visibility="{Binding ShowPageSize, Converter={StaticResource BoolToVisibleConvert}}" />
  73. </StackPanel>
  74. </Border>
  75. </Grid>
  76. <DataTemplate.Triggers>
  77. <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
  78. <Setter TargetName="BdBorder" Property="BorderThickness" Value="1" />
  79. <Setter TargetName="BdBorder" Property="CornerRadius" Value="4" />
  80. <Setter TargetName="BdPageNum" Property="Background" Value="Blue" />
  81. <Setter TargetName="BdPageNum" Property="CornerRadius" Value="4" />
  82. </DataTrigger>
  83. </DataTemplate.Triggers>
  84. </DataTemplate>
  85. </ResourceDictionary>
  86. </UserControl.Resources>
  87. <Border
  88. BorderBrush="#F2F2F2"
  89. BorderThickness="0,1,0,0"
  90. Visibility="{Binding IsVisible, Mode=TwoWay}">
  91. <Grid>
  92. <Grid.RowDefinitions>
  93. <RowDefinition Height="40" />
  94. <RowDefinition />
  95. </Grid.RowDefinitions>
  96. <Grid Background="#FFFFFF">
  97. <StackPanel Name="StkpnlCenter" />
  98. <StackPanel Name="StkpnlRight" />
  99. </Grid>
  100. <ListBox
  101. Name="ListPageEdit"
  102. Grid.Row="1"
  103. Padding="0"
  104. AllowDrop="True"
  105. ItemTemplate="{StaticResource PageEditListBoxItemTemplate}"
  106. ItemsSource="{Binding PageEditItems}"
  107. ScrollBar.Scroll="ListPageEdit_Scroll"
  108. ScrollViewer.CanContentScroll="True"
  109. ScrollViewer.ScrollChanged="ListPageEdit_ScrollChanged"
  110. SelectedIndex="{Binding SelectedIndex}"
  111. SelectionMode="Extended"
  112. VirtualizingPanel.CacheLength="1"
  113. VirtualizingPanel.CacheLengthUnit="Page"
  114. VirtualizingPanel.ScrollUnit="Pixel"
  115. VirtualizingPanel.VirtualizationMode="Standard">
  116. <ListBox.ItemContainerStyle>
  117. <Style TargetType="{x:Type ListBoxItem}">
  118. <Setter Property="Template" Value="{StaticResource ListBoxItemControlTemplate}" />
  119. <Setter Property="Margin" Value="0,10" />
  120. <Setter Property="Visibility" Value="{Binding Visible}" />
  121. </Style>
  122. </ListBox.ItemContainerStyle>
  123. <ListBox.ItemsPanel>
  124. <ItemsPanelTemplate>
  125. <wpftk:VirtualizingWrapPanel />
  126. </ItemsPanelTemplate>
  127. </ListBox.ItemsPanel>
  128. </ListBox>
  129. </Grid>
  130. </Border>
  131. </UserControl>