CPDFPageEditControl.xaml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <UserControl x:Class="ComPDFKit.Controls.PDFControl.CPDFPageEditControl"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:ComPDFKit.Controls.PDFControl"
  7. Loaded="UserControl_Loaded"
  8. Unloaded="UserControl_Unloaded"
  9. PreviewMouseWheel ="UserControl_PreviewMouseWheel"
  10. IsVisibleChanged="PageEditor_IsVisibleChanged"
  11. PreviewKeyDown="UserControl_KeyDown"
  12. MouseEnter="UserControl_MouseEnter"
  13. xmlns:wpftk="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
  14. mc:Ignorable="d"
  15. SizeChanged="UserControl_SizeChanged"
  16. xmlns:cpdfcommon="clr-namespace:ComPDFKit.Controls.Common"
  17. d:DesignHeight="450" d:DesignWidth="800">
  18. <UserControl.Resources>
  19. <ResourceDictionary>
  20. <ResourceDictionary.MergedDictionaries>
  21. <ResourceDictionary Source="../../Asset/Styles/ListBoxItemStyle.xaml"></ResourceDictionary>
  22. </ResourceDictionary.MergedDictionaries>
  23. <cpdfcommon:CommonResourceConverter x:Key="CommonResourceConverter" />
  24. <ContextMenu x:Key="FlyoutMenu" FontSize="14" Loaded="ContextMenu_Loaded">
  25. <ContextMenu.ItemContainerStyle>
  26. <Style TargetType="{x:Type MenuItem}">
  27. <Setter Property="Padding" Value="0,8,0,8"/>
  28. <Setter Property="VerticalContentAlignment" Value="Center"/>
  29. </Style>
  30. </ContextMenu.ItemContainerStyle>
  31. <MenuItem Name="LeftRotate" Header="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Menu_RotateLeft}" IsEnabled="True" Click="Rotate_Click"></MenuItem>
  32. <MenuItem Name="RightRotate" Header="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Menu_RotateRight}" IsEnabled="True" Click="Rotate_Click"></MenuItem>
  33. <MenuItem Name="Copy" Header="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Menu_Copy}" IsEnabled="True" Click="Copy_Click"></MenuItem>
  34. <MenuItem Name="Delete" Header="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Menu_Delete}" Click="Delete_Click"></MenuItem>
  35. </ContextMenu>
  36. <RoutedUICommand x:Key="LeftRotate" Text="Left rotate"/>
  37. <RoutedUICommand x:Key="RightRotate" Text="Right rotate"/>
  38. <RoutedUICommand x:Key="Delete" Text="Delete"/>
  39. <RoutedUICommand x:Key="Copy" Text="Copy"/>
  40. <Grid x:Key="bookMarkIco">
  41. <Polygon Fill="#FFBB00" Points="16.75 1.25 3.25 1.25 3.25 19.4013878 10 14.902 16.75 19.4013878" Visibility="Visible"/>
  42. </Grid>
  43. </ResourceDictionary>
  44. </UserControl.Resources>
  45. <UserControl.InputBindings>
  46. <KeyBinding Gesture="Ctrl+L" Command="{StaticResource LeftRotate}" />
  47. <KeyBinding Gesture="Ctrl+R" Command="{StaticResource RightRotate}" />
  48. <KeyBinding Gesture="Ctrl+C" Command="{StaticResource Copy}" />
  49. <KeyBinding Gesture="Delete" Command="{StaticResource Delete}" />
  50. </UserControl.InputBindings>
  51. <UserControl.CommandBindings>
  52. <CommandBinding Command="{StaticResource LeftRotate}" Executed="CommandBinding_Executed_LeftRotate"/>
  53. <CommandBinding Command="{StaticResource RightRotate}" Executed="CommandBinding_Executed_RightRotate"/>
  54. <CommandBinding Command="{StaticResource Delete}" Executed="CommandBinding_Executed_Delete"/>
  55. <CommandBinding Command="{StaticResource Copy}" Executed="CommandBinding_Executed_Copy"/>
  56. </UserControl.CommandBindings>
  57. <Grid>
  58. <Grid Name="PageGrid" DragOver="Grid_DragOver" PreviewDragEnter="PageGrid_PreviewDragEnter" >
  59. <ListBox Name="PageEditListBox" SelectionChanged="PageEditListBox_SelectionChanged"
  60. SelectionMode="Extended" ScrollViewer.CanContentScroll="True"
  61. AllowDrop="True"
  62. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  63. ScrollViewer.ScrollChanged="PageEditListBox_ScrollChanged"
  64. ScrollBar.Scroll="PageEditListBox_Scroll"
  65. KeyUp="PageEditListBox_KeyUp"
  66. PreviewMouseMove="PageEditListBox_PreviewMouseMove"
  67. PreviewMouseLeftButtonDown="PageEditListBox_PreviewMouseLeftButtonDown"
  68. MouseLeftButtonUp="PageEditListBox_MouseLeftButtonUp"
  69. Drop="PageEditListBox_Drop"
  70. SizeChanged="PageEditListBox_SizeChanged"
  71. Background="Transparent"
  72. BorderThickness="0"
  73. VirtualizingPanel.VirtualizationMode="Standard"
  74. VirtualizingPanel.CacheLengthUnit="Page"
  75. VirtualizingPanel.CacheLength="1"
  76. VirtualizingPanel.ScrollUnit="Pixel"
  77. >
  78. <ListBox.ItemContainerStyle>
  79. <Style TargetType="{x:Type ListBoxItem}">
  80. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  81. <Setter Property="VerticalContentAlignment" Value="Center"/>
  82. <EventSetter Event="DragLeave" Handler="ListBoxItem_DragLeave"/>
  83. <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>
  84. <EventSetter Event="PreviewMouseDoubleClick" Handler="ListBoxItem_PreviewMouseDoubleClick"/>
  85. <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown"/>
  86. <Setter Property="Template" Value="{DynamicResource ListBoxItemControlTemplate}"/>
  87. <Setter Property="Width" Value="auto"/>
  88. </Style>
  89. </ListBox.ItemContainerStyle>
  90. <ListBox.ItemsPanel>
  91. <ItemsPanelTemplate>
  92. <wpftk:VirtualizingWrapPanel Margin="0 0 0 0" Name="PART_Panel" Background="White"></wpftk:VirtualizingWrapPanel>
  93. </ItemsPanelTemplate>
  94. </ListBox.ItemsPanel>
  95. </ListBox>
  96. <ProgressBar Name="progress" Height="15" Width="400" IsIndeterminate="True" Visibility="Collapsed"/>
  97. <Border Name="tip" Visibility="Collapsed" CornerRadius="4" Background="#89000000" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,150">
  98. <TextBlock x:Name="PageViewTipText" Margin="12,4" Foreground="White" FontSize="14" Padding="4 2 4 2"/>
  99. </Border>
  100. <Line Name="MidLane" StrokeStartLineCap="Triangle" StrokeEndLineCap="Triangle" Visibility="Collapsed" AllowDrop="True" Drop="MidLane_Drop" X1="20" X2="20" Y1="0" Y2="150" Stroke="#FF477EDE" StrokeThickness="5"/>
  101. <Image Name="ShadowPicture" Opacity="0.8" Visibility="{Binding ElementName=MidLane,Path=Visibility}" AllowDrop="True" Drop="ShadowPicture_Drop" RenderOptions.BitmapScalingMode="HighQuality" UseLayoutRounding="True" HorizontalAlignment="Left" VerticalAlignment="Top"/>
  102. <Rectangle Name="ChooseRect" VerticalAlignment="Top" HorizontalAlignment="Left" Stroke="#AACCEE" StrokeThickness ="2" Fill ="#AACCEE" Opacity="0.3"/>
  103. </Grid>
  104. <Border x:Name="AlertBorder" Height="30" Width="auto" Background="#CE1A1A1A" VerticalAlignment="Top" HorizontalAlignment="Center" CornerRadius="4" Margin="10" Visibility="Collapsed">
  105. <TextBlock x:Name="AlertTextBlock" Foreground="#FFFFFF" Text="Empty" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10,5,10,5"></TextBlock>
  106. </Border>
  107. </Grid>
  108. </UserControl>