SharpsAnnotProperty.xaml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <UserControl
  2. x:Class="PDF_Office.Views.PropertyPanel.AnnotPanel.SharpsAnnotProperty"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:CompositeControl="clr-namespace:PDF_Office.CustomControl.CompositeControl"
  6. xmlns:Convert="clr-namespace:PDF_Office.DataConvert"
  7. xmlns:DashConvert="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel"
  8. xmlns:cus="clr-namespace:PDF_Office.CustomControl"
  9. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  10. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  11. xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel"
  12. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  13. xmlns:prism="http://prismlibrary.com/"
  14. d:DesignHeight="450"
  15. d:DesignWidth="260"
  16. Background="{StaticResource color.sys.layout.mg}"
  17. prism:ViewModelLocator.AutoWireViewModel="True"
  18. mc:Ignorable="d">
  19. <UserControl.Resources>
  20. <ResourceDictionary>
  21. <ResourceDictionary.MergedDictionaries>
  22. <ResourceDictionary Source="../../../Styles/SliderStyle.xaml" />
  23. <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml" />
  24. </ResourceDictionary.MergedDictionaries>
  25. <Convert:ColorToBrushConverter x:Key="ColorToBrushConvert" />
  26. <Convert:CheckToVisibleMutiConvert x:Key="CheckToVisibleMutiConvert" />
  27. <DashConvert:DashStyleConverter x:Key="DashStyleConverter" />
  28. <Convert:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert" />
  29. <Style x:Key="line1Style" TargetType="{x:Type Line}">
  30. <Setter Property="Visibility">
  31. <Setter.Value>
  32. <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
  33. <Binding ElementName="SharpRectBtn" Path="IsChecked" />
  34. <Binding ElementName="SharpCircleBtn" Path="IsChecked" />
  35. </MultiBinding>
  36. </Setter.Value>
  37. </Setter>
  38. </Style>
  39. <Style x:Key="line2Style" TargetType="{x:Type Line}">
  40. <Setter Property="Visibility">
  41. <Setter.Value>
  42. <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
  43. <Binding ElementName="SharpCircleBtn" Path="IsChecked" />
  44. <Binding ElementName="SharpArrowBtn" Path="IsChecked" />
  45. </MultiBinding>
  46. </Setter.Value>
  47. </Setter>
  48. </Style>
  49. <Style x:Key="line3Style" TargetType="{x:Type Line}">
  50. <Setter Property="Visibility">
  51. <Setter.Value>
  52. <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
  53. <Binding ElementName="SharpArrowBtn" Path="IsChecked" />
  54. <Binding ElementName="SharpLineBtn" Path="IsChecked" />
  55. </MultiBinding>
  56. </Setter.Value>
  57. </Setter>
  58. </Style>
  59. </ResourceDictionary>
  60. </UserControl.Resources>
  61. <Grid Margin="16,0,16,0">
  62. <StackPanel>
  63. <TextBlock
  64. Name="AnnotTypeTitle"
  65. Margin="10,8,0,0"
  66. HorizontalAlignment="Left"
  67. FontFamily="SegoeUI"
  68. FontSize="18"
  69. FontWeight="Bold"
  70. LineHeight="24"
  71. Text="{Binding BasicVm.AnnotTypeTitle}" />
  72. <Border
  73. Width="228"
  74. Height="100"
  75. Margin="0,8,0,0"
  76. Background="White"
  77. BorderBrush="#DDDDDD"
  78. BorderThickness="1"
  79. CornerRadius="2"
  80. Visibility="{Binding BasicVm.IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}">
  81. <Grid>
  82. <Path
  83. Name="SharpPath"
  84. Width="36"
  85. Height="36"
  86. HorizontalAlignment="Center"
  87. VerticalAlignment="Center"
  88. Data="{Binding DataPath}"
  89. Fill="{Binding BasicVm.FillColor}"
  90. Opacity="{Binding BasicVm.FillOpacity}"
  91. Stroke="{Binding BasicVm.BorderColor}"
  92. StrokeDashArray="{Binding Dash, Converter={StaticResource DashStyleConverter}}"
  93. StrokeStartLineCap="Flat"
  94. StrokeThickness="{Binding BasicVm.AnnotThickness}">
  95. <!-- ,Converter={StaticResource ColorToBrushConvert} -->
  96. </Path>
  97. </Grid>
  98. </Border>
  99. <Border
  100. Width="162"
  101. Height="32"
  102. Margin="0,12,0,0"
  103. BorderBrush="#FFE2E3E6"
  104. BorderThickness="0" HorizontalAlignment="Left"
  105. Visibility="{Binding BasicVm.IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}">
  106. <Grid Name="ToolGrid">
  107. <Grid.ColumnDefinitions>
  108. <ColumnDefinition Width="40.5" />
  109. <ColumnDefinition Width="40.5" />
  110. <ColumnDefinition Width="40.5" />
  111. <ColumnDefinition Width="40.5" />
  112. </Grid.ColumnDefinitions>
  113. <RadioButton x:Name="SharpRectBtn" Tag="Rect" GroupName="Shape"
  114. Width="32" Height="32" Margin="0,0" ToolTip="矩形" Padding="7,0,0,0"
  115. VerticalContentAlignment="Center" Background="Transparent"
  116. Style="{DynamicResource GreyBgRadioBtnStyle}">
  117. <RadioButton.Content>
  118. <Rectangle
  119. Width="16"
  120. Height="16"
  121. HorizontalAlignment="Center"
  122. VerticalAlignment="Center"
  123. Stroke="#273C62" />
  124. </RadioButton.Content>
  125. <i:Interaction.Triggers>
  126. <i:EventTrigger EventName="Checked">
  127. <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpRectBtn, Path=Tag}" />
  128. </i:EventTrigger>
  129. </i:Interaction.Triggers>
  130. </RadioButton>
  131. <RadioButton x:Name="SharpCircleBtn" Tag="Circle" GroupName="Shape" Grid.Column="1"
  132. Width="32" Height="32" Margin="0,0" ToolTip="圆" Padding="7,0,0,0"
  133. VerticalContentAlignment="Center" Background="Transparent"
  134. Style="{DynamicResource GreyBgRadioBtnStyle}">
  135. <RadioButton.Content>
  136. <Ellipse
  137. Width="16"
  138. Height="16"
  139. HorizontalAlignment="Center"
  140. VerticalAlignment="Center"
  141. Stroke="#273C62" />
  142. </RadioButton.Content>
  143. <i:Interaction.Triggers>
  144. <i:EventTrigger EventName="Checked">
  145. <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpCircleBtn, Path=Tag}" />
  146. </i:EventTrigger>
  147. </i:Interaction.Triggers>
  148. </RadioButton>
  149. <RadioButton x:Name="SharpArrowBtn" Tag="Arrow" GroupName="Shape" Grid.Column="2"
  150. Width="32" Height="32" Margin="0,0" ToolTip="箭头" Padding="7,0,0,0"
  151. VerticalContentAlignment="Center" Background="Transparent"
  152. Style="{DynamicResource GreyBgRadioBtnStyle}">
  153. <RadioButton.Content>
  154. <Path
  155. Width="16"
  156. Height="16"
  157. HorizontalAlignment="Center"
  158. VerticalAlignment="Center"
  159. Fill="#273C62">
  160. <Path.Data>
  161. M13.4,2.6 L13.4,8 L12.2,8 L12.1997359,4.648 L2.02426407,14.8242641 L1.17573593,13.9757359 L11.3517359,3.799 L8,3.8 L8,2.6 L13.4,2.6 Z
  162. </Path.Data>
  163. </Path>
  164. </RadioButton.Content>
  165. <i:Interaction.Triggers>
  166. <i:EventTrigger EventName="Checked">
  167. <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpArrowBtn, Path=Tag}" />
  168. </i:EventTrigger>
  169. </i:Interaction.Triggers>
  170. </RadioButton>
  171. <RadioButton x:Name="SharpLineBtn" Tag="Line" GroupName="Shape" Grid.Column="3"
  172. Width="32" Height="32" Margin="0,0" ToolTip="线条" Padding="7,0,0,0"
  173. VerticalContentAlignment="Center" Background="Transparent"
  174. Style="{DynamicResource GreyBgRadioBtnStyle}">
  175. <RadioButton.Content>
  176. <Polygon
  177. Width="16"
  178. Height="16"
  179. HorizontalAlignment="Center"
  180. VerticalAlignment="Center"
  181. Fill="#273C62">
  182. <Polygon.Points>
  183. 13.1757359 1.97573593 14.0242641 2.82426407 2.82426407 14.0242641 1.97573593 13.1757359
  184. </Polygon.Points>
  185. </Polygon>
  186. </RadioButton.Content>
  187. <i:Interaction.Triggers>
  188. <i:EventTrigger EventName="Checked">
  189. <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpLineBtn, Path=Tag}" />
  190. </i:EventTrigger>
  191. </i:Interaction.Triggers>
  192. </RadioButton>
  193. </Grid>
  194. </Border>
  195. <Grid x:Name="GridFill" Margin="0,18,0,0" Visibility="{Binding IsLineAnnot,Converter={StaticResource InvertBoolToVisibleConvert}}">
  196. <Grid.RowDefinitions>
  197. <RowDefinition Height="auto" />
  198. <RowDefinition />
  199. </Grid.RowDefinitions>
  200. <TextBlock Text="Fill" Foreground="{StaticResource color.sys.text.neutral.lv2}" VerticalAlignment="Center" />
  201. <CompositeControl:SlidContent x:Name="layerFill" HorizontalAlignment="Right"
  202. InitValue="{Binding BasicVm.FillOpacity,Mode=OneWay}"
  203. Visibility="{Binding BasicVm.IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}">
  204. <i:Interaction.Triggers>
  205. <i:EventTrigger EventName="SelectedValueChanged">
  206. <i:InvokeCommandAction Command="{Binding SelectedOpacityValueCommand}" CommandParameter="{Binding ElementName=layerFill,Path=Value}" />
  207. </i:EventTrigger>
  208. </i:Interaction.Triggers>
  209. </CompositeControl:SlidContent>
  210. <CompositeControl:ColorContent x:Name="cusFillColor" Grid.Row="1" Margin="0,8,0,0"
  211. ItemSource="{Binding BasicVm.FillColorItems}"
  212. ColorType="Fill"
  213. UIColor="{Binding BasicVm.CurrentFillColor,Mode=OneWay}">
  214. <i:Interaction.Triggers>
  215. <i:EventTrigger EventName="SelectedColorInvoke">
  216. <i:InvokeCommandAction Command="{Binding SelectedFillColorCommand}" CommandParameter="{Binding ElementName=cusFillColor,Path=SelectedColor}" />
  217. </i:EventTrigger>
  218. </i:Interaction.Triggers>
  219. </CompositeControl:ColorContent>
  220. </Grid>
  221. <Grid Margin="0,18,0,0">
  222. <Grid.RowDefinitions>
  223. <RowDefinition Height="auto" />
  224. <RowDefinition />
  225. </Grid.RowDefinitions>
  226. <TextBlock Text="Border" Foreground="{StaticResource color.sys.text.neutral.lv2}" VerticalAlignment="Center" />
  227. <CompositeControl:SlidContent x:Name="layerThick" HorizontalAlignment="Right"
  228. InitValue="{Binding BasicVm.FillOpacity,Mode=OneWay}"
  229. Visibility="{Binding BasicVm.IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}">
  230. <i:Interaction.Triggers>
  231. <i:EventTrigger EventName="SelectedValueChanged">
  232. <i:InvokeCommandAction Command="{Binding SelectedOpacityValueCommand}" CommandParameter="{Binding ElementName=layerThick,Path=Value}" />
  233. </i:EventTrigger>
  234. </i:Interaction.Triggers>
  235. </CompositeControl:SlidContent>
  236. <CompositeControl:ColorContent x:Name="cusColor" Grid.Row="1" Margin="0,8,0,0"
  237. ItemSource="{Binding BasicVm.ColorItems}"
  238. ColorType="Border"
  239. UIColor="{Binding BasicVm.CurrentBorderColor,Mode=OneWay}">
  240. <i:Interaction.Triggers>
  241. <i:EventTrigger EventName="SelectedColorInvoke">
  242. <i:InvokeCommandAction Command="{Binding SelectedBorderColorCommand}" CommandParameter="{Binding ElementName=cusColor,Path=SelectedColor}" />
  243. </i:EventTrigger>
  244. </i:Interaction.Triggers>
  245. </CompositeControl:ColorContent>
  246. </Grid>
  247. <CompositeControl:SlidComboControl x:Name="thickness" Margin="0,0,0,0" ItemsSource="{Binding ThicknessItems}" Value="{Binding BasicVm.AnnotThickness,Mode=TwoWay}">
  248. <i:Interaction.Triggers>
  249. <i:EventTrigger EventName="ValueChanged">
  250. <i:InvokeCommandAction Command="{Binding SelectedThickCommand}" CommandParameter="{Binding ElementName=thickness,Path=Value}" />
  251. </i:EventTrigger>
  252. </i:Interaction.Triggers>
  253. </CompositeControl:SlidComboControl>
  254. <StackPanel x:Name="PnlLineStyle" Orientation="Horizontal" Margin="0,20,0,0">
  255. <RadioButton x:Name="BtnSolid" Tag="Solid" GroupName="LineMode"
  256. Width="105" Height="32" Margin="0,0,10,0" Foreground="#616469"
  257. VerticalContentAlignment="Center" Background="Transparent"
  258. Command="{Binding LineStyleCommand}"
  259. CommandParameter="{Binding ElementName=BtnSolid, Path=Tag}"
  260. IsChecked="{Binding BasicVm.IsSolidLine}"
  261. Style="{DynamicResource GreyBgRadioBtnStyle}">
  262. <RadioButton.Content>
  263. <Line X1="10" Y1="5" X2="90" Y2="5" Stroke="Black" StrokeThickness="2" />
  264. </RadioButton.Content>
  265. </RadioButton>
  266. <RadioButton x:Name="BtnDashed" Tag="Dashed" GroupName="LineMode"
  267. Width="105" Height="32" Margin="0,0" Foreground="#616469"
  268. VerticalContentAlignment="Center" Background="Transparent"
  269. Command="{Binding LineStyleCommand}"
  270. CommandParameter="{Binding ElementName=BtnDashed, Path=Tag}"
  271. IsChecked="{Binding BasicVm.IsDashLine}"
  272. Style="{DynamicResource GreyBgRadioBtnStyle}">
  273. <RadioButton.Content>
  274. <Line X1="10" Y1="5" X2="90" Y2="5" Stroke="Black" StrokeThickness="2" StrokeDashArray="2" />
  275. </RadioButton.Content>
  276. </RadioButton>
  277. </StackPanel>
  278. </StackPanel>
  279. </Grid>
  280. </UserControl>