PrintPreviewControl.xaml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <UserControl x:Class="ComPDFKit.Controls.PDFControl.PrintPreviewControl"
  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. mc:Ignorable="d"
  8. d:DesignHeight="360" d:DesignWidth="240" Background="#F7F8FA">
  9. <UserControl.Resources>
  10. <Style x:Key="PrePageBtnStyle" TargetType="Button">
  11. <Setter Property="Height" Value="24" />
  12. <Setter Property="Width" Value="24" />
  13. <Setter Property="Template">
  14. <Setter.Value>
  15. <ControlTemplate TargetType="{x:Type Button}">
  16. <Grid x:Name="UserfulRegion">
  17. <Border
  18. x:Name="border"
  19. BorderBrush="#5A000000"
  20. BorderThickness="1"
  21. CornerRadius="4">
  22. <Grid>
  23. <Rectangle
  24. Width="24"
  25. Height="24"
  26. Fill="Transparent" />
  27. <Path
  28. x:Name="Path"
  29. Width="24"
  30. Height="24"
  31. HorizontalAlignment="Center"
  32. VerticalAlignment="Center"
  33. Data="M10.0607 12.1L14.6303 7.53039L13.5696 6.46973L8.46967 11.5697C8.17678 11.8626 8.17678 12.3374 8.46967 12.6303L13.5696 17.7303L14.6303 16.6696L10.0607 12.1Z"
  34. Fill="#8A000000" />
  35. </Grid>
  36. </Border>
  37. </Grid>
  38. <ControlTemplate.Triggers>
  39. <Trigger Property="IsMouseOver" Value="True">
  40. <Setter TargetName="border" Property="Background" Value="#cccccc" />
  41. </Trigger>
  42. </ControlTemplate.Triggers>
  43. </ControlTemplate>
  44. </Setter.Value>
  45. </Setter>
  46. </Style>
  47. <Style x:Key="NextPageBtnStyle" TargetType="Button">
  48. <Setter Property="Template">
  49. <Setter.Value>
  50. <ControlTemplate TargetType="{x:Type Button}">
  51. <Grid x:Name="UserfulRegion">
  52. <Border
  53. x:Name="border"
  54. BorderBrush="#5A000000"
  55. BorderThickness="1"
  56. CornerRadius="4">
  57. <Grid>
  58. <Rectangle
  59. Width="24"
  60. Height="24"
  61. Fill="Transparent" />
  62. <Path
  63. x:Name="Path"
  64. Width="24"
  65. Height="24"
  66. HorizontalAlignment="Center"
  67. VerticalAlignment="Center"
  68. Data="M13.9393 12.1L9.36972 7.53039L10.4304 6.46973L15.5303 11.5697C15.8232 11.8626 15.8232 12.3374 15.5303 12.6303L10.4304 17.7303L9.36972 16.6696L13.9393 12.1Z"
  69. Fill="#8A000000" />
  70. </Grid>
  71. </Border>
  72. </Grid>
  73. <ControlTemplate.Triggers>
  74. <Trigger Property="IsMouseOver" Value="True">
  75. <Setter TargetName="border" Property="Background" Value="#cccccc" />
  76. </Trigger>
  77. </ControlTemplate.Triggers>
  78. </ControlTemplate>
  79. </Setter.Value>
  80. </Setter>
  81. </Style>
  82. </UserControl.Resources>
  83. <Grid>
  84. <Grid.RowDefinitions>
  85. <RowDefinition Height="20"></RowDefinition>
  86. <RowDefinition></RowDefinition>
  87. <RowDefinition Height="40"></RowDefinition>
  88. </Grid.RowDefinitions>
  89. <StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal">
  90. <TextBlock Text="{Binding PaperKind}" Margin="0,0,10,0"></TextBlock>
  91. <TextBlock Text="size"></TextBlock>
  92. <TextBlock Text="{Binding PaperWidth}"></TextBlock>
  93. <TextBlock Text="*"></TextBlock>
  94. <TextBlock Text="{Binding PaperHeight}"></TextBlock>
  95. </StackPanel>
  96. <Grid Grid.Row="1" Margin="5">
  97. <Border BorderThickness="1" BorderBrush="#5a000000" Background="#1a000000" Height="{Binding ViewBoxHeight}" Width="{Binding ViewBoxWidth}">
  98. <Viewbox>
  99. <Image Name="imgPrint" RenderOptions.BitmapScalingMode="HighQuality" Source="{Binding PreviewBitmapSource}" Margin="{Binding Margins}">
  100. </Image>
  101. </Viewbox>
  102. </Border>
  103. </Grid>
  104. <StackPanel Grid.Row="2" HorizontalAlignment="Center" Orientation="Horizontal">
  105. <Button x:Name="btnPreButton" Height="32" Width="36" Style="{StaticResource PrePageBtnStyle}" Margin="0,0,12,0" Click="btnPreButton_Click"></Button>
  106. <TextBox x:Name="txbPageIndex" Height="32" Width="50" Text="{Binding PaperIndex, UpdateSourceTrigger=PropertyChanged}" LostFocus="txbPageIndex_LostFocus" PreviewLostKeyboardFocus="txbPageIndex_PreviewLostKeyboardFocus" TextAlignment="Center" VerticalContentAlignment="Center"></TextBox>
  107. <TextBlock Text=" of " VerticalAlignment="Center"></TextBlock>
  108. <TextBlock Text="{Binding PrintedPageCount}" VerticalAlignment="Center"></TextBlock>
  109. <Button x:Name="btnNextButton" Style="{StaticResource NextPageBtnStyle}" Height="32" Width="36" Margin="12,0,0,0" Click="btnNextButton_Click"></Button>
  110. </StackPanel>
  111. </Grid>
  112. </UserControl>