SignatureCreateDialog.xaml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <UserControl x:Class="PDF_Office.Views.PropertyPanel.AnnotPanel.SignatureCreateDialog"
  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:cus="clr-namespace:PDF_Office.CustomControl" xmlns:annotpanel="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel" xmlns:dataconvert="clr-namespace:PDF_Office.DataConvert" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" d:DataContext="{d:DesignInstance Type=annotpanel:SignatureCreateDialogViewModel}"
  7. mc:Ignorable="d" >
  8. <UserControl.Resources>
  9. <Style TargetType="{x:Type TabItem}">
  10. <Setter Property="Width" Value="74.67 " />
  11. <Setter Property="Height" Value="28" />
  12. <Setter Property="BorderThickness" Value="0" />
  13. <Setter Property="Template" Value="{DynamicResource Segmented}" />
  14. </Style>
  15. <dataconvert:UnVisivleConvert x:Key="UnVisivleConvert"/>
  16. <dataconvert:IntAndTagToBoolMultiBinding x:Key="IntAndTagToBoolMultiBinding"/>
  17. <dataconvert:IntToColorBrush x:Key="IntToColorBrush"/>
  18. <dataconvert:ListCountToVisible x:Key="ListCountToVisible"/>
  19. <dataconvert:CenterToolTipConverter x:Key="CenterToolTipConverter"/>
  20. <Style x:Key="TriangleToolTipStyle" TargetType="ToolTip">
  21. <Setter Property="Template">
  22. <Setter.Value>
  23. <ControlTemplate>
  24. <StackPanel>
  25. <Path HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 6 0 L 0 6 L 12 6 Z" Fill="#E6333333" Margin="0,0,10,0"/>
  26. <Border CornerRadius="8" Background="#E6333333" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
  27. <TextBlock Text="{TemplateBinding ContentControl.Content}" Foreground="White" LineHeight="20" Margin="6"/>
  28. </Border>
  29. </StackPanel>
  30. </ControlTemplate>
  31. </Setter.Value>
  32. </Setter>
  33. </Style>
  34. </UserControl.Resources>
  35. <cus:DialogContent Header="新建签名">
  36. <cus:DialogContent.Content>
  37. <TabControl
  38. Style="{StaticResource FormTabControl }"
  39. SelectedIndex="{Binding TabItemIndex,Mode=TwoWay}">
  40. <TabItem Header="Input">
  41. <Grid>
  42. <Grid.RowDefinitions>
  43. <RowDefinition Height="*"/>
  44. <RowDefinition Height="32"/>
  45. </Grid.RowDefinitions>
  46. <cus:TextBoxEx PlaceholderText="Input" Text="{Binding InputText,Mode=TwoWay}" Foreground ="{Binding RadioButtonIndex,Converter={StaticResource IntToColorBrush}}" />
  47. <ComboBox Grid.Row="1"
  48. Width="200"
  49. HorizontalAlignment="Left"
  50. VerticalContentAlignment="Center"
  51. ItemsSource="{Binding FontNameList}"
  52. SelectedIndex="{Binding FontNameIndex,Mode=TwoWay}"/>
  53. <StackPanel Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
  54. <cus:PathRadioButton Tag="1" Checked="TextRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
  55. <cus:PathRadioButton.Content>
  56. <Grid Width="32" Height="32">
  57. <Ellipse Width="11" Height="11" Fill="Black"/>
  58. </Grid>
  59. </cus:PathRadioButton.Content>
  60. <i:Interaction.Triggers>
  61. <i:EventTrigger EventName="Checked">
  62. <i:InvokeCommandAction Command="{Binding CheckedCommnad}"
  63. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=RadioButton},Path=Tag}"
  64. PassEventArgsToCommand="True" />
  65. </i:EventTrigger>
  66. </i:Interaction.Triggers>
  67. <RadioButton.IsChecked>
  68. <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
  69. <Binding Source="1"/>
  70. <Binding Path="RadioButtonIndex"/>
  71. </MultiBinding>
  72. </RadioButton.IsChecked>
  73. </cus:PathRadioButton>
  74. <cus:PathRadioButton Tag="2" Checked="TextRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
  75. <cus:PathRadioButton.Content>
  76. <Grid Width="32" Height="32">
  77. <Ellipse Width="11" Height="11" Fill="#F66B7C"/>
  78. </Grid>
  79. </cus:PathRadioButton.Content>
  80. <i:Interaction.Triggers>
  81. <i:EventTrigger EventName="Checked">
  82. <i:InvokeCommandAction Command="{Binding CheckedCommnad}"
  83. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=RadioButton},Path=Tag}"
  84. PassEventArgsToCommand="True" />
  85. </i:EventTrigger>
  86. </i:Interaction.Triggers>
  87. <RadioButton.IsChecked>
  88. <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
  89. <Binding Source="2"/>
  90. <Binding Path="RadioButtonIndex"/>
  91. </MultiBinding>
  92. </RadioButton.IsChecked>
  93. </cus:PathRadioButton>
  94. <cus:PathRadioButton Tag="3" Checked="TextRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
  95. <cus:PathRadioButton.Content>
  96. <Grid Width="32" Height="32">
  97. <Ellipse Width="11" Height="11" Fill="#48DDAD"/>
  98. </Grid>
  99. </cus:PathRadioButton.Content>
  100. <i:Interaction.Triggers>
  101. <i:EventTrigger EventName="Checked">
  102. <i:InvokeCommandAction Command="{Binding CheckedCommnad}"
  103. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=RadioButton},Path=Tag}"
  104. PassEventArgsToCommand="True" />
  105. </i:EventTrigger>
  106. </i:Interaction.Triggers>
  107. <RadioButton.IsChecked>
  108. <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
  109. <Binding Source="3"/>
  110. <Binding Path="RadioButtonIndex"/>
  111. </MultiBinding>
  112. </RadioButton.IsChecked>
  113. </cus:PathRadioButton>
  114. <cus:PathRadioButton Tag="4" Checked="TextRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
  115. <cus:PathRadioButton.Content>
  116. <Grid Width="32" Height="32">
  117. <Ellipse Width="11" Height="11" Fill="#458DF6"/>
  118. </Grid>
  119. </cus:PathRadioButton.Content>
  120. <i:Interaction.Triggers>
  121. <i:EventTrigger EventName="Checked">
  122. <i:InvokeCommandAction Command="{Binding CheckedCommnad}"
  123. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=RadioButton},Path=Tag}"
  124. PassEventArgsToCommand="True" />
  125. </i:EventTrigger>
  126. </i:Interaction.Triggers>
  127. <RadioButton.IsChecked>
  128. <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
  129. <Binding Source="4"/>
  130. <Binding Path="RadioButtonIndex"/>
  131. </MultiBinding>
  132. </RadioButton.IsChecked>
  133. </cus:PathRadioButton>
  134. </StackPanel>
  135. </Grid>
  136. </TabItem>
  137. <TabItem Header="Drawing">
  138. <Grid>
  139. <Grid.RowDefinitions>
  140. <RowDefinition Height="*"/>
  141. <RowDefinition Height="32"/>
  142. </Grid.RowDefinitions>
  143. <InkCanvas x:Name="inkCanvas" Width="240" Height="240" DefaultDrawingAttributes="{Binding DrawingAttributeObject}" Strokes="{Binding StrokesObject}"/>
  144. <Grid Opacity="0.7" x:Name="PlanGrid" IsHitTestVisible="False" Background="#F3F3F3" Visibility="{Binding StrokesObject.Count,Converter={StaticResource ListCountToVisible}}">
  145. <TextBlock Text="此处绘制签名" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  146. </Grid>
  147. <Button Style="{StaticResource btn.sec}" Width="50" Height="50" HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Clear" Command="{Binding ClearInkCanvasCommnad}" Visibility="{Binding ElementName=PlanGrid,Path=Visibility}"/>
  148. <ComboBox Grid.Row="1"
  149. Width="80"
  150. HorizontalAlignment="Left"
  151. VerticalContentAlignment="Center"
  152. ItemsSource="{Binding ThicknessList}"
  153. SelectedIndex="{Binding ThicknessListIndex,Mode=TwoWay}"/>
  154. <StackPanel Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal" >
  155. <cus:PathRadioButton Tag="1" Checked="ImageRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
  156. <cus:PathRadioButton.Content>
  157. <Grid Width="32" Height="32">
  158. <Ellipse Width="11" Height="11" Fill="Black"/>
  159. </Grid>
  160. </cus:PathRadioButton.Content>
  161. <i:Interaction.Triggers>
  162. <i:EventTrigger EventName="Checked">
  163. <i:InvokeCommandAction Command="{Binding CheckedCommnad}"
  164. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=RadioButton},Path=Tag}"
  165. PassEventArgsToCommand="True" />
  166. </i:EventTrigger>
  167. </i:Interaction.Triggers>
  168. <RadioButton.IsChecked>
  169. <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
  170. <Binding Source="1"/>
  171. <Binding Path="ImageRadioButtonIndex"/>
  172. </MultiBinding>
  173. </RadioButton.IsChecked>
  174. </cus:PathRadioButton>
  175. <cus:PathRadioButton Tag="2" Checked="ImageRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
  176. <cus:PathRadioButton.Content>
  177. <Grid Width="32" Height="32">
  178. <Ellipse Width="11" Height="11" Fill="#F66B7C"/>
  179. </Grid>
  180. </cus:PathRadioButton.Content>
  181. <i:Interaction.Triggers>
  182. <i:EventTrigger EventName="Checked">
  183. <i:InvokeCommandAction Command="{Binding CheckedCommnad}"
  184. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=RadioButton},Path=Tag}"
  185. PassEventArgsToCommand="True" />
  186. </i:EventTrigger>
  187. </i:Interaction.Triggers>
  188. <RadioButton.IsChecked>
  189. <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
  190. <Binding Source="2"/>
  191. <Binding Path="ImageRadioButtonIndex"/>
  192. </MultiBinding>
  193. </RadioButton.IsChecked>
  194. </cus:PathRadioButton>
  195. <cus:PathRadioButton Tag="3" Checked="ImageRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
  196. <cus:PathRadioButton.Content>
  197. <Grid Width="32" Height="32">
  198. <Ellipse Width="11" Height="11" Fill="#48DDAD"/>
  199. </Grid>
  200. </cus:PathRadioButton.Content>
  201. <i:Interaction.Triggers>
  202. <i:EventTrigger EventName="Checked">
  203. <i:InvokeCommandAction Command="{Binding CheckedCommnad}"
  204. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=RadioButton},Path=Tag}"
  205. PassEventArgsToCommand="True" />
  206. </i:EventTrigger>
  207. </i:Interaction.Triggers>
  208. <RadioButton.IsChecked>
  209. <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
  210. <Binding Source="3"/>
  211. <Binding Path="ImageRadioButtonIndex"/>
  212. </MultiBinding>
  213. </RadioButton.IsChecked>
  214. </cus:PathRadioButton>
  215. <cus:PathRadioButton Tag="4" Checked="ImageRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
  216. <cus:PathRadioButton.Content>
  217. <Grid Width="32" Height="32">
  218. <Ellipse Width="11" Height="11" Fill="#458DF6"/>
  219. </Grid>
  220. </cus:PathRadioButton.Content>
  221. <i:Interaction.Triggers>
  222. <i:EventTrigger EventName="Checked">
  223. <i:InvokeCommandAction Command="{Binding CheckedCommnad}"
  224. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=RadioButton},Path=Tag}"
  225. PassEventArgsToCommand="True" />
  226. </i:EventTrigger>
  227. </i:Interaction.Triggers>
  228. <RadioButton.IsChecked>
  229. <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
  230. <Binding Source="4"/>
  231. <Binding Path="ImageRadioButtonIndex"/>
  232. </MultiBinding>
  233. </RadioButton.IsChecked>
  234. </cus:PathRadioButton>
  235. </StackPanel>
  236. </Grid>
  237. </TabItem>
  238. <TabItem Header="Picture">
  239. <Grid>
  240. <Grid.RowDefinitions>
  241. <RowDefinition Height="*"/>
  242. <RowDefinition Height="20"/>
  243. </Grid.RowDefinitions>
  244. <Button x:Name="BtnAdd" Width="50" Height="50" Content="添加图片" Command="{Binding OpenImageCommnad}" Visibility="{Binding ShowImageButton}"/>
  245. <Grid Visibility="{Binding ElementName=BtnAdd,Path=Visibility,Converter={StaticResource UnVisivleConvert}}">
  246. <Grid.RowDefinitions>
  247. <RowDefinition Height="24"/>
  248. <RowDefinition Height="*"/>
  249. </Grid.RowDefinitions>
  250. <Image Grid.RowSpan="2" Width="200" Height="200" Source="{Binding ImagePreviewSource}" />
  251. <Button Grid.Row="1" Width="50" Height="50" HorizontalAlignment="Left" VerticalAlignment="Bottom" Content="清除" Command="{Binding ClearImageCommnad}"/>
  252. <Button Grid.Row="1" Width="50" Height="50" HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="重新选择" Command="{Binding OpenImageCommnad}"/>
  253. </Grid>
  254. <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
  255. <CheckBox Width="20" Height="20" IsChecked="{Binding IsRemoveBackground}"/>
  256. <cus:ImageButton Margin="8,0,0,0"
  257. Height="16" Width="16" IconHeight="16" IconWidth="16"
  258. Icon="pack://application:,,,/PDF Office;component/Resources/Dialog/help.png"
  259. IconPress="pack://application:,,,/PDF Office;component/Resources/Dialog/help.png"
  260. IconMouseOver="pack://application:,,,/PDF Office;component/Resources/Dialog/help.png">
  261. <cus:ImageButton.ToolTip >
  262. <ToolTip Style ="{StaticResource TriangleToolTipStyle}" Placement="Bottom" Content="Remove white background from images" >
  263. <ToolTip.HorizontalOffset>
  264. <MultiBinding Converter="{StaticResource CenterToolTipConverter}">
  265. <Binding RelativeSource="{RelativeSource Self}" Path="PlacementTarget.ActualWidth"/>
  266. <Binding RelativeSource="{RelativeSource Self}" Path="ActualWidth"/>
  267. </MultiBinding>
  268. </ToolTip.HorizontalOffset>
  269. </ToolTip>
  270. </cus:ImageButton.ToolTip>
  271. </cus:ImageButton>
  272. </StackPanel>
  273. </Grid>
  274. </TabItem>
  275. </TabControl>
  276. </cus:DialogContent.Content>
  277. <cus:DialogContent.BottmBar>
  278. <Grid>
  279. <Grid.ColumnDefinitions>
  280. <ColumnDefinition Width="50*" />
  281. <ColumnDefinition Width="50*" />
  282. </Grid.ColumnDefinitions>
  283. <Button
  284. Style="{StaticResource Btn.cta}"
  285. Grid.Column="0"
  286. Width="150"
  287. Height="32"
  288. Margin="25,0,0,0"
  289. HorizontalAlignment="Right"
  290. Command="{Binding CreateCommnad}"
  291. Content="确定" />
  292. <Button
  293. Style="{StaticResource btn.sec}"
  294. Grid.Column="1"
  295. Width="150"
  296. Height="32"
  297. Margin="0,0,25,0"
  298. HorizontalAlignment="Right"
  299. Command="{Binding CancelCommand}"
  300. Content="取消" />
  301. </Grid>
  302. </cus:DialogContent.BottmBar>
  303. </cus:DialogContent>
  304. </UserControl>