SignatureCreateDialog.xaml 25 KB

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