SignatureCreateDialog.xaml 26 KB

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