PreviewerWindow.axaml 5.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <Window xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:previewer="clr-namespace:QuestPDF.Previewer"
  6. mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
  7. x:Class="QuestPDF.Previewer.PreviewerWindow"
  8. x:DataType="previewer:PreviewerWindowViewModel"
  9. x:CompileBindings="True"
  10. WindowStartupLocation="CenterScreen"
  11. ExtendClientAreaToDecorationsHint="true"
  12. ExtendClientAreaTitleBarHeightHint="-1"
  13. Background="#666"
  14. Icon="/Resources/Logo.png"
  15. UseLayoutRounding="True"
  16. Title="QuestPDF Document Preview">
  17. <Window.Styles>
  18. <Style Selector="Button.actions">
  19. <Setter Property="VerticalAlignment" Value="Bottom"/>
  20. <Setter Property="HorizontalAlignment" Value="Left"/>
  21. <Setter Property="Padding" Value="10"/>
  22. <Setter Property="CornerRadius" Value="100"/>
  23. <Setter Property="Background" Value="#888"/>
  24. </Style>
  25. <Style Selector="Button:pointerover /template/ ContentPresenter">
  26. <Setter Property="Background" Value="#999"/>
  27. </Style>
  28. </Window.Styles>
  29. <Panel>
  30. <Grid>
  31. <Grid.RowDefinitions>
  32. <RowDefinition Height="32" />
  33. <RowDefinition Height="*" />
  34. </Grid.RowDefinitions>
  35. <Grid.ColumnDefinitions>
  36. <ColumnDefinition Width="*" />
  37. <ColumnDefinition Width="Auto" />
  38. </Grid.ColumnDefinitions>
  39. <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
  40. VerticalAlignment="Center" HorizontalAlignment="Center"
  41. TextAlignment="Center" Text="QuestPDF Previewer" FontSize="14" Foreground="#DFFF" FontWeight="Regular" IsHitTestVisible="False" />
  42. <previewer:PreviewerControl Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
  43. HorizontalAlignment="Stretch"
  44. VerticalAlignment="Stretch"
  45. CurrentScroll="{Binding CurrentScroll, Mode=TwoWay}"
  46. ScrollViewportSize="{Binding ScrollViewportSize, Mode=OneWayToSource}"
  47. Pages="{Binding Pages, Mode=OneWay}" />
  48. <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Vertical" VerticalAlignment="Bottom" Spacing="16" Margin="32">
  49. <Button Classes="actions"
  50. Command="{Binding ShowPdfCommand, Mode=OneTime}"
  51. IsVisible="{Binding !!Pages.Count}"
  52. ToolTip.Tip="Generates PDF file and shows it in the default browser. Useful for testing compatibility and interactive links.">
  53. <Viewbox Width="24" Height="24">
  54. <Canvas Width="24" Height="24">
  55. <Path Fill="White" Data="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H13C12.59,21.75 12.2,21.44 11.86,21.1C11.53,20.77 11.25,20.4 11,20H6V4H13V9H18V10.18C18.71,10.34 19.39,10.61 20,11V8L14,2M20.31,18.9C21.64,16.79 21,14 18.91,12.68C16.8,11.35 14,12 12.69,14.08C11.35,16.19 12,18.97 14.09,20.3C15.55,21.23 17.41,21.23 18.88,20.32L22,23.39L23.39,22L20.31,18.9M16.5,19A2.5,2.5 0 0,1 14,16.5A2.5,2.5 0 0,1 16.5,14A2.5,2.5 0 0,1 19,16.5A2.5,2.5 0 0,1 16.5,19Z" />
  56. </Canvas>
  57. </Viewbox>
  58. </Button>
  59. <Button Classes="actions"
  60. Command="{Binding ShowDocumentationCommand, Mode=OneTime}"
  61. ToolTip.Tip="Opens official QuestPDF documentation">
  62. <Viewbox Width="24" Height="24">
  63. <Canvas Width="24" Height="24">
  64. <Path Fill="White" Data="M19 1L14 6V17L19 12.5V1M21 5V18.5C19.9 18.15 18.7 18 17.5 18C15.8 18 13.35 18.65 12 19.5V6C10.55 4.9 8.45 4.5 6.5 4.5C4.55 4.5 2.45 4.9 1 6V20.65C1 20.9 1.25 21.15 1.5 21.15C1.6 21.15 1.65 21.1 1.75 21.1C3.1 20.45 5.05 20 6.5 20C8.45 20 10.55 20.4 12 21.5C13.35 20.65 15.8 20 17.5 20C19.15 20 20.85 20.3 22.25 21.05C22.35 21.1 22.4 21.1 22.5 21.1C22.75 21.1 23 20.85 23 20.6V6C22.4 5.55 21.75 5.25 21 5M10 18.41C8.75 18.09 7.5 18 6.5 18C5.44 18 4.18 18.19 3 18.5V7.13C3.91 6.73 5.14 6.5 6.5 6.5C7.86 6.5 9.09 6.73 10 7.13V18.41Z" />
  65. </Canvas>
  66. </Viewbox>
  67. </Button>
  68. <Button Classes="actions"
  69. Command="{Binding SponsorProjectCommand, Mode=OneTime}"
  70. ToolTip.Tip="Do you like QuestPDF? Please consider sponsoring the project. It really helps!">
  71. <Viewbox Width="24" Height="24">
  72. <Canvas Width="24" Height="24">
  73. <Path Fill="White" Data="M12,21.1L10.5,22.4C3.9,16.5 0.5,13.4 0.5,9.6C0.5,8.4 0.9,7.3 1.5,6.4C1.5,6.6 1.5,6.8 1.5,7C1.5,11.7 5.4,15.2 12,21.1M13.6,17C18.3,12.7 21.5,9.9 21.6,7C21.6,5 20.1,3.5 18.1,3.5C16.5,3.5 15,4.5 14.5,5.9H12.6C12,4.5 10.5,3.5 9,3.5C7,3.5 5.5,5 5.5,7C5.5,9.9 8.6,12.7 13.4,17L13.5,17.1M18,1.5C21.1,1.5 23.5,3.9 23.5,7C23.5,10.7 20.1,13.8 13.5,19.8C6.9,13.9 3.5,10.8 3.5,7C3.5,3.9 5.9,1.5 9,1.5C10.7,1.5 12.4,2.3 13.5,3.6C14.6,2.3 16.3,1.5 18,1.5Z" />
  74. </Canvas>
  75. </Viewbox>
  76. </Button>
  77. </StackPanel>
  78. <ScrollBar Grid.Row="1" Grid.Column="1"
  79. Orientation="Vertical"
  80. AllowAutoHide="False"
  81. Minimum="0" Maximum="1"
  82. IsVisible="{Binding VerticalScrollbarVisible, Mode=OneWay}"
  83. Value="{Binding CurrentScroll, Mode=TwoWay}"
  84. ViewportSize="{Binding ScrollViewportSize, Mode=OneWay}"></ScrollBar>
  85. </Grid>
  86. </Panel>
  87. </Window>