CPDFStampUI.xaml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <UserControl x:Class="compdfkit_tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI.CPDFStampUI"
  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_tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI"
  7. mc:Ignorable="d"
  8. d:DesignHeight="450" d:DesignWidth="800">
  9. <UserControl.DataContext>
  10. <local:CPDFStampUIViewModel/>
  11. </UserControl.DataContext>
  12. <UserControl.Resources>
  13. <SolidColorBrush x:Key="TabItem.Selected.Background" Color="#FFFFFF"/>
  14. <SolidColorBrush x:Key="TabItem.Selected.Border" Color="#ACACAC"/>
  15. <Style x:Key="TabControlStyle1" TargetType="{x:Type TabControl}">
  16. <Setter Property="Padding" Value="2"/>
  17. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  18. <Setter Property="VerticalContentAlignment" Value="Center"/>
  19. <Setter Property="Background" Value="{StaticResource TabItem.Selected.Background}"/>
  20. <Setter Property="BorderBrush" Value="{StaticResource TabItem.Selected.Border}"/>
  21. <Setter Property="BorderThickness" Value="1"/>
  22. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
  23. <Setter Property="Template">
  24. <Setter.Value>
  25. <ControlTemplate TargetType="{x:Type TabControl}">
  26. <Grid x:Name="templateRoot" ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
  27. <Grid.ColumnDefinitions>
  28. <ColumnDefinition x:Name="ColumnDefinition0"/>
  29. <ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
  30. </Grid.ColumnDefinitions>
  31. <Grid.RowDefinitions>
  32. <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
  33. <RowDefinition x:Name="RowDefinition1" Height="*"/>
  34. </Grid.RowDefinitions>
  35. <UniformGrid x:Name="headerPanel" Background="Transparent" Grid.Column="0" HorizontalAlignment="Stretch" IsItemsHost="true" Margin="2,2,2,0" Grid.Row="0" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1" Rows="1"/>
  36. <Border x:Name="contentPanel" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
  37. <ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  38. </Border>
  39. </Grid>
  40. <ControlTemplate.Triggers>
  41. <Trigger Property="TabStripPlacement" Value="Bottom">
  42. <Setter Property="Grid.Row" TargetName="headerPanel" Value="1"/>
  43. <Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
  44. <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
  45. <Setter Property="Height" TargetName="RowDefinition1" Value="Auto"/>
  46. <Setter Property="Margin" TargetName="headerPanel" Value="2,0,2,2"/>
  47. </Trigger>
  48. <Trigger Property="TabStripPlacement" Value="Left">
  49. <Setter Property="Grid.Row" TargetName="headerPanel" Value="0"/>
  50. <Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
  51. <Setter Property="Grid.Column" TargetName="headerPanel" Value="0"/>
  52. <Setter Property="Grid.Column" TargetName="contentPanel" Value="1"/>
  53. <Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto"/>
  54. <Setter Property="Width" TargetName="ColumnDefinition1" Value="*"/>
  55. <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
  56. <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
  57. <Setter Property="Margin" TargetName="headerPanel" Value="2,2,0,2"/>
  58. </Trigger>
  59. <Trigger Property="TabStripPlacement" Value="Right">
  60. <Setter Property="Grid.Row" TargetName="headerPanel" Value="0"/>
  61. <Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
  62. <Setter Property="Grid.Column" TargetName="headerPanel" Value="1"/>
  63. <Setter Property="Grid.Column" TargetName="contentPanel" Value="0"/>
  64. <Setter Property="Width" TargetName="ColumnDefinition0" Value="*"/>
  65. <Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto"/>
  66. <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
  67. <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
  68. <Setter Property="Margin" TargetName="headerPanel" Value="0,2,2,2"/>
  69. </Trigger>
  70. <Trigger Property="IsEnabled" Value="false">
  71. <Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  72. </Trigger>
  73. </ControlTemplate.Triggers>
  74. </ControlTemplate>
  75. </Setter.Value>
  76. </Setter>
  77. </Style>
  78. </UserControl.Resources>
  79. <Grid>
  80. <TabControl Style="{DynamicResource TabControlStyle1}">
  81. <TabItem Header="Standard">
  82. <ListBox
  83. Height="auto"
  84. VerticalAlignment="Top"
  85. Background="Transparent"
  86. BorderThickness="0"
  87. ItemsSource="{Binding StandardStampList}"
  88. />
  89. </TabItem>
  90. <TabItem Header="Customize">
  91. <Grid>
  92. <Grid.RowDefinitions>
  93. <RowDefinition Height="20"/>
  94. <RowDefinition Height="auto"/>
  95. <RowDefinition Height="auto"/>
  96. </Grid.RowDefinitions>
  97. <UniformGrid Rows="1" >
  98. <Button Content="文字" Height="20" Click="Text_Click"/>
  99. <Button Content="图片" Height="20"/>
  100. </UniformGrid>
  101. <ListView
  102. Grid.Row="1"
  103. Height="auto"
  104. VerticalAlignment="Top"
  105. Background="Transparent"
  106. BorderThickness="0"
  107. ItemsSource="{Binding CustomStampList}"
  108. />
  109. </Grid>
  110. </TabItem>
  111. </TabControl>
  112. </Grid>
  113. </UserControl>