SignatureCreateDialog.xaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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. </UserControl.Resources>
  19. <cus:DialogContent Header="新建签名">
  20. <cus:DialogContent.Content>
  21. <TabControl
  22. Style="{StaticResource FormTabControl }"
  23. SelectedIndex="{Binding TabItemIndex,Mode=TwoWay}">
  24. <TabItem Header="Input">
  25. <Grid>
  26. <Grid.RowDefinitions>
  27. <RowDefinition Height="*"/>
  28. <RowDefinition Height="32"/>
  29. </Grid.RowDefinitions>
  30. <cus:TextBoxEx PlaceholderText="Input" Text="{Binding InputText,Mode=TwoWay}" Foreground ="{Binding RadioButtonIndex,Converter={StaticResource IntToColorBrush}}" />
  31. <ComboBox Grid.Row="1"
  32. Width="200"
  33. HorizontalAlignment="Left"
  34. VerticalContentAlignment="Center"
  35. ItemsSource="{Binding FontNameList}"
  36. SelectedIndex="{Binding FontNameIndex,Mode=TwoWay}"/>
  37. <StackPanel Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
  38. <RadioButton Tag="1" Checked="TextRadioButton_Checked">
  39. <i:Interaction.Triggers>
  40. <i:EventTrigger EventName="Checked">
  41. <i:InvokeCommandAction Command="{Binding CheckedCommnad}"
  42. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=RadioButton},Path=Tag}"
  43. PassEventArgsToCommand="True" />
  44. </i:EventTrigger>
  45. </i:Interaction.Triggers>
  46. <RadioButton.IsChecked>
  47. <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
  48. <Binding Source="1"/>
  49. <Binding Path="RadioButtonIndex"/>
  50. </MultiBinding>
  51. </RadioButton.IsChecked>
  52. </RadioButton>
  53. <RadioButton Tag="2" Checked="TextRadioButton_Checked">
  54. <i:Interaction.Triggers>
  55. <i:EventTrigger EventName="Checked">
  56. <i:InvokeCommandAction Command="{Binding CheckedCommnad}"
  57. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=RadioButton},Path=Tag}"
  58. PassEventArgsToCommand="True" />
  59. </i:EventTrigger>
  60. </i:Interaction.Triggers>
  61. <RadioButton.IsChecked>
  62. <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
  63. <Binding Source="2"/>
  64. <Binding Path="RadioButtonIndex"/>
  65. </MultiBinding>
  66. </RadioButton.IsChecked>
  67. </RadioButton>
  68. <RadioButton Tag="3" Checked="TextRadioButton_Checked">
  69. <i:Interaction.Triggers>
  70. <i:EventTrigger EventName="Checked">
  71. <i:InvokeCommandAction Command="{Binding CheckedCommnad}"
  72. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=RadioButton},Path=Tag}"
  73. PassEventArgsToCommand="True" />
  74. </i:EventTrigger>
  75. </i:Interaction.Triggers>
  76. <RadioButton.IsChecked>
  77. <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
  78. <Binding Source="3"/>
  79. <Binding Path="RadioButtonIndex"/>
  80. </MultiBinding>
  81. </RadioButton.IsChecked>
  82. </RadioButton>
  83. <RadioButton Tag="4" Checked="TextRadioButton_Checked">
  84. <i:Interaction.Triggers>
  85. <i:EventTrigger EventName="Checked">
  86. <i:InvokeCommandAction Command="{Binding CheckedCommnad}"
  87. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=RadioButton},Path=Tag}"
  88. PassEventArgsToCommand="True" />
  89. </i:EventTrigger>
  90. </i:Interaction.Triggers>
  91. <RadioButton.IsChecked>
  92. <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
  93. <Binding Source="4"/>
  94. <Binding Path="RadioButtonIndex"/>
  95. </MultiBinding>
  96. </RadioButton.IsChecked>
  97. </RadioButton>
  98. </StackPanel>
  99. </Grid>
  100. </TabItem>
  101. <TabItem Header="Drawing">
  102. <Grid>
  103. <Grid.RowDefinitions>
  104. <RowDefinition Height="*"/>
  105. <RowDefinition Height="32"/>
  106. </Grid.RowDefinitions>
  107. <InkCanvas x:Name="inkCanvas" Width="240" Height="240" DefaultDrawingAttributes="{Binding DrawingAttributeObject}" Strokes="{Binding StrokesObject}"/>
  108. <ComboBox Grid.Row="1"
  109. Width="80"
  110. HorizontalAlignment="Left"
  111. VerticalContentAlignment="Center"
  112. ItemsSource="{Binding ThicknessList}"
  113. SelectedIndex="{Binding ThicknessListIndex,Mode=TwoWay}"/>
  114. <StackPanel Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
  115. <RadioButton Tag="1" Checked="ImageRadioButton_Checked">
  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="1"/>
  126. <Binding Path="ImageRadioButtonIndex"/>
  127. </MultiBinding>
  128. </RadioButton.IsChecked>
  129. </RadioButton>
  130. <RadioButton Tag="2" Checked="ImageRadioButton_Checked">
  131. <i:Interaction.Triggers>
  132. <i:EventTrigger EventName="Checked">
  133. <i:InvokeCommandAction Command="{Binding CheckedCommnad}"
  134. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=RadioButton},Path=Tag}"
  135. PassEventArgsToCommand="True" />
  136. </i:EventTrigger>
  137. </i:Interaction.Triggers>
  138. <RadioButton.IsChecked>
  139. <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
  140. <Binding Source="2"/>
  141. <Binding Path="ImageRadioButtonIndex"/>
  142. </MultiBinding>
  143. </RadioButton.IsChecked>
  144. </RadioButton>
  145. <RadioButton Tag="3" Checked="ImageRadioButton_Checked">
  146. <i:Interaction.Triggers>
  147. <i:EventTrigger EventName="Checked">
  148. <i:InvokeCommandAction Command="{Binding CheckedCommnad}"
  149. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=RadioButton},Path=Tag}"
  150. PassEventArgsToCommand="True" />
  151. </i:EventTrigger>
  152. </i:Interaction.Triggers>
  153. <RadioButton.IsChecked>
  154. <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
  155. <Binding Source="3"/>
  156. <Binding Path="ImageRadioButtonIndex"/>
  157. </MultiBinding>
  158. </RadioButton.IsChecked>
  159. </RadioButton>
  160. <RadioButton Tag="4" Checked="ImageRadioButton_Checked">
  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="4"/>
  171. <Binding Path="ImageRadioButtonIndex"/>
  172. </MultiBinding>
  173. </RadioButton.IsChecked>
  174. </RadioButton>
  175. </StackPanel>
  176. </Grid>
  177. </TabItem>
  178. <TabItem Header="Picture">
  179. <Grid>
  180. <Grid.RowDefinitions>
  181. <RowDefinition Height="*"/>
  182. <RowDefinition Height="20"/>
  183. </Grid.RowDefinitions>
  184. <Button x:Name="BtnAdd" Width="50" Height="50" Content="添加图片" Command="{Binding OpenImageCommnad}" Visibility="{Binding ShowImageButton}"/>
  185. <Grid Visibility="{Binding ElementName=BtnAdd,Path=Visibility,Converter={StaticResource UnVisivleConvert}}">
  186. <Grid.RowDefinitions>
  187. <RowDefinition Height="24"/>
  188. <RowDefinition Height="*"/>
  189. </Grid.RowDefinitions>
  190. <Image Grid.RowSpan="2" Width="200" Height="200" Source="{Binding ImagePreviewSource}" />
  191. </Grid>
  192. <CheckBox Grid.Row="1" Width="20" Height="20" IsChecked="{Binding IsRemoveBackground}"/>
  193. </Grid>
  194. </TabItem>
  195. </TabControl>
  196. </cus:DialogContent.Content>
  197. <cus:DialogContent.BottmBar>
  198. <Grid>
  199. <Grid.ColumnDefinitions>
  200. <ColumnDefinition Width="50*" />
  201. <ColumnDefinition Width="50*" />
  202. </Grid.ColumnDefinitions>
  203. <Button
  204. Style="{StaticResource Btn.cta}"
  205. Grid.Column="0"
  206. Width="150"
  207. Height="32"
  208. Margin="25,0,0,0"
  209. HorizontalAlignment="Right"
  210. Command="{Binding CreateCommnad}"
  211. Content="确定" />
  212. <Button
  213. Style="{StaticResource btn.sec}"
  214. Grid.Column="1"
  215. Width="150"
  216. Height="32"
  217. Margin="0,0,25,0"
  218. HorizontalAlignment="Right"
  219. Command="{Binding CancelCommand}"
  220. Content="取消" />
  221. </Grid>
  222. </cus:DialogContent.BottmBar>
  223. </cus:DialogContent>
  224. </UserControl>