SignatureAnnotProperty.xaml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <UserControl x:Class="PDF_Office.Views.PropertyPanel.AnnotPanel.SignatureAnnotProperty"
  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:PDF_Office.Views.PropertyPanel.AnnotPanel" xmlns:customcontrol="clr-namespace:PDF_Office.CustomControl" xmlns:annotpanel="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel" xmlns:dataconvert="clr-namespace:PDF_Office.DataConvert" d:DataContext="{d:DesignInstance Type=annotpanel:SignatureAnnotPropertyViewModel}"
  7. KeyDown="UserControl_KeyDown"
  8. Loaded="UserControl_Loaded" Background="{StaticResource color.sys.layout.mg}"
  9. mc:Ignorable="d">
  10. <UserControl.Resources>
  11. <PathGeometry x:Key="Ic_AddButtonPath" Figures="M13.5 8C13.5 11.0376 11.0376 13.5 8 13.5C4.96243 13.5 2.5 11.0376 2.5 8C2.5 4.96243 4.96243 2.5 8 2.5C11.0376 2.5 13.5 4.96243 13.5 8ZM15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM7.25005 4.80003V7.25003H4.80005V8.75003H7.25005V11.2H8.75005V8.75003H11.2V7.25003H8.75005V4.80003H7.25005Z" FillRule="EvenOdd" />
  12. <dataconvert:ListCountToVisible x:Key="ListCountToVisible" />
  13. <dataconvert:UnVisivleConvert x:Key="UnVisivleConvert" />
  14. <SolidColorBrush x:Key="Item.SelectedInactive.Background" Color="#3DDADADA" />
  15. <SolidColorBrush x:Key="Item.SelectedInactive.Border" Color="#FFDADADA" />
  16. </UserControl.Resources>
  17. <Grid Background="{StaticResource color.sys.layout.mg}">
  18. <Grid.RowDefinitions>
  19. <RowDefinition Height="50" />
  20. <RowDefinition Height="*" />
  21. </Grid.RowDefinitions>
  22. <Grid.ColumnDefinitions>
  23. <ColumnDefinition Width="16" />
  24. <ColumnDefinition Width="*" />
  25. <ColumnDefinition Width="16" />
  26. </Grid.ColumnDefinitions>
  27. <Grid x:Name="Header" Grid.Column="1">
  28. <Grid.ColumnDefinitions>
  29. <ColumnDefinition Width="16" />
  30. <ColumnDefinition Width="*" />
  31. <ColumnDefinition Width="16" />
  32. </Grid.ColumnDefinitions>
  33. <TextBlock Grid.Column="1" x:Name="TxtTitle" HorizontalAlignment="Left"
  34. VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" />
  35. <customcontrol:PathButton Grid.Column="1"
  36. HorizontalAlignment="Right"
  37. HorizontalContentAlignment="Center"
  38. x:Name="BtnAdd"
  39. BorderThickness="1"
  40. CornerRadius="4"
  41. Command="{Binding ShowDialogCommand}"
  42. Height="32" Width="32" IconHeight="16" IconWidth="16"
  43. Icon="{StaticResource Ic_AddButtonPath}" IconFill="#585A63"
  44. IconPress="{StaticResource Ic_AddButtonPath}" IconPressFill="#585A63"
  45. IconMouseOver="{StaticResource Ic_AddButtonPath}" IconMouseOverFill="#585A63"
  46. MouseOverBackground="{StaticResource color.item-state.hov.bg}"
  47. MouseDownBackground="{StaticResource color.item-state.sel.bg.lv3}"
  48. MouseDownBorderBrush="{StaticResource color.item-state.sel.border.lv3}" />
  49. </Grid>
  50. <Grid Grid.Row="1" Grid.Column="1">
  51. <StackPanel VerticalAlignment="Center" x:Name="NoSignatureStackPanel" Visibility="{Binding SignatureList.Count, Converter={StaticResource ListCountToVisible}}">
  52. <Image Width="128" Height="128" Source="pack://application:,,,/PDF Office;component/Resources/PropertyPanel/nosign.png" />
  53. <TextBlock Text="No signature created" FontSize="14" FontFamily="Segoe UI" Height="22" HorizontalAlignment="Center" />
  54. <TextBlock Width="168" Text="Click the Add button in the upper right corner to create a new signature." FontSize="12" FontFamily="Segoe UI" TextWrapping="Wrap" Foreground="#94989C" HorizontalAlignment="Center" />
  55. </StackPanel>
  56. <ListBox ItemsSource="{Binding SignatureList}"
  57. SelectedIndex="{Binding CurrentListboxIndex,Mode=TwoWay}"
  58. Visibility="{Binding ElementName=NoSignatureStackPanel,Path=Visibility,Converter={StaticResource UnVisivleConvert}}"
  59. SelectionMode="Single" Height="auto" VerticalAlignment="Stretch" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
  60. <ListBox.ItemTemplate>
  61. <DataTemplate>
  62. <Grid>
  63. <Grid.ContextMenu>
  64. <ContextMenu>
  65. <MenuItem Header="导出签名">
  66. <MenuItem x:Name="SavePNG" Header="PNG" Tag="PNG" Click="Save_Click" />
  67. <MenuItem x:Name="SavePDF" Header="PDF" Tag="PDF" Click="Save_Click" />
  68. </MenuItem>
  69. <MenuItem x:Name="Delete" Header="删除签名" Click="Delete_Click" />
  70. <MenuItem x:Name="DeleteAll" Header="删除全部签名" Click="DeleteAll_Click" />
  71. </ContextMenu>
  72. </Grid.ContextMenu>
  73. <Image Source="{Binding SourcePath}" Stretch="Uniform" Height="48" />
  74. </Grid>
  75. </DataTemplate>
  76. </ListBox.ItemTemplate>
  77. <ListBox.ItemContainerStyle>
  78. <Style TargetType="ListBoxItem">
  79. <Setter Property="Height" Value="65" />
  80. <Setter Property="Padding" Value="8" />
  81. <Setter Property="HorizontalContentAlignment" Value="Center" />
  82. <Setter Property="Template">
  83. <Setter.Value>
  84. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  85. <Border x:Name="Bd" CornerRadius="8" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
  86. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  87. </Border>
  88. <ControlTemplate.Triggers>
  89. <MultiTrigger>
  90. <MultiTrigger.Conditions>
  91. <Condition Property="IsMouseOver" Value="True" />
  92. </MultiTrigger.Conditions>
  93. <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}" />
  94. <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}" />
  95. </MultiTrigger>
  96. <MultiTrigger>
  97. <MultiTrigger.Conditions>
  98. <Condition Property="Selector.IsSelectionActive" Value="False" />
  99. <Condition Property="IsSelected" Value="True" />
  100. </MultiTrigger.Conditions>
  101. <Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Background}" />
  102. <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Border}" />
  103. </MultiTrigger>
  104. <MultiTrigger>
  105. <MultiTrigger.Conditions>
  106. <Condition Property="Selector.IsSelectionActive" Value="True" />
  107. <Condition Property="IsSelected" Value="True" />
  108. </MultiTrigger.Conditions>
  109. <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  110. <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.sel.border.lv3}" />
  111. </MultiTrigger>
  112. <Trigger Property="IsEnabled" Value="False">
  113. <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  114. </Trigger>
  115. </ControlTemplate.Triggers>
  116. </ControlTemplate>
  117. </Setter.Value>
  118. </Setter>
  119. <EventSetter Event="PreviewMouseDown" Handler="ListBoxItem_PreviewMouseDown" />
  120. </Style>
  121. </ListBox.ItemContainerStyle>
  122. </ListBox>
  123. </Grid>
  124. </Grid>
  125. </UserControl>