SharpsAnnotProperty.xaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <UserControl
  2. x:Class="PDF_Master.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_Master.CustomControl.CompositeControl"
  6. xmlns:Convert="clr-namespace:PDF_Master.DataConvert"
  7. xmlns:DashConvert="clr-namespace:PDF_Master.ViewModels.PropertyPanel.AnnotPanel"
  8. xmlns:convert="clr-namespace:PDF_Master.Views.Tools"
  9. xmlns:cus="clr-namespace:PDF_Master.CustomControl"
  10. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  11. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  12. xmlns:local="clr-namespace:PDF_Master.Views.PropertyPanel.AnnotPanel"
  13. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  14. xmlns:prism="http://prismlibrary.com/"
  15. d:DesignHeight="800"
  16. d:DesignWidth="260"
  17. prism:ViewModelLocator.AutoWireViewModel="True"
  18. Background="{StaticResource color.sys.layout.mg}"
  19. mc:Ignorable="d">
  20. <UserControl.Resources>
  21. <ResourceDictionary>
  22. <ResourceDictionary.MergedDictionaries>
  23. <ResourceDictionary Source="../../../Styles/SliderStyle.xaml" />
  24. <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml" />
  25. </ResourceDictionary.MergedDictionaries>
  26. <Convert:ColorToBrushConverter x:Key="ColorToBrushConvert" />
  27. <Convert:CheckToVisibleMutiConvert x:Key="CheckToVisibleMutiConvert" />
  28. <convert:AnnotToolIsCheckedConvert x:Key="AnnotToolIsCheckedConvert" />
  29. <DashConvert:DashStyleConverter x:Key="DashStyleConverter" />
  30. <Convert:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert" />
  31. <Convert:BoolToVisible x:Key="BoolToVisible" />
  32. <Style x:Key="line1Style" TargetType="{x:Type Line}">
  33. <Setter Property="Visibility">
  34. <Setter.Value>
  35. <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
  36. <Binding ElementName="SharpRectBtn" Path="IsChecked" />
  37. <Binding ElementName="SharpCircleBtn" Path="IsChecked" />
  38. </MultiBinding>
  39. </Setter.Value>
  40. </Setter>
  41. </Style>
  42. <Style x:Key="line2Style" TargetType="{x:Type Line}">
  43. <Setter Property="Visibility">
  44. <Setter.Value>
  45. <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
  46. <Binding ElementName="SharpCircleBtn" Path="IsChecked" />
  47. <Binding ElementName="SharpArrowBtn" Path="IsChecked" />
  48. </MultiBinding>
  49. </Setter.Value>
  50. </Setter>
  51. </Style>
  52. <Style x:Key="line3Style" TargetType="{x:Type Line}">
  53. <Setter Property="Visibility">
  54. <Setter.Value>
  55. <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
  56. <Binding ElementName="SharpArrowBtn" Path="IsChecked" />
  57. <Binding ElementName="SharpLineBtn" Path="IsChecked" />
  58. </MultiBinding>
  59. </Setter.Value>
  60. </Setter>
  61. </Style>
  62. </ResourceDictionary>
  63. </UserControl.Resources>
  64. <Grid Margin="16,0,16,0">
  65. <StackPanel>
  66. <TextBlock
  67. Name="AnnotTypeTitle"
  68. Margin="0,14"
  69. HorizontalAlignment="Left"
  70. FontFamily="Segoe UI"
  71. FontSize="14"
  72. FontWeight="SemiBold"
  73. LineHeight="24"
  74. Text="{Binding BasicVm.AnnotTypeTitle}" />
  75. <Border
  76. Width="228"
  77. Height="100"
  78. Background="White"
  79. BorderBrush="#DDDDDD"
  80. BorderThickness="1"
  81. CornerRadius="2"
  82. Visibility="{Binding BasicVm.IsMultiSelected, Converter={StaticResource InvertBoolToVisibleConvert}}">
  83. <Grid>
  84. <Path
  85. Name="SharpPath"
  86. Width="36"
  87. Height="36"
  88. HorizontalAlignment="Center"
  89. VerticalAlignment="Center"
  90. Data="{Binding DataPath}"
  91. Fill="{Binding BasicVm.FillColor}"
  92. Opacity="{Binding BasicVm.FillOpacity}"
  93. Stroke="{Binding BasicVm.BorderColor}"
  94. StrokeDashArray="{Binding Dash, Converter={StaticResource DashStyleConverter}}"
  95. StrokeStartLineCap="Flat"
  96. StrokeThickness="{Binding BasicVm.AnnotThickness}">
  97. <!-- ,Converter={StaticResource ColorToBrushConvert} -->
  98. </Path>
  99. </Grid>
  100. </Border>
  101. <Border
  102. Width="162"
  103. Height="32"
  104. Margin="0,12,0,0"
  105. HorizontalAlignment="Left"
  106. BorderBrush="#FFE2E3E6"
  107. BorderThickness="0"
  108. Visibility="{Binding BasicVm.IsSharpAnnotSelected, Converter={StaticResource BoolToVisible}}">
  109. <Grid Name="ToolGrid">
  110. <Grid.ColumnDefinitions>
  111. <ColumnDefinition Width="40.5" />
  112. <ColumnDefinition Width="40.5" />
  113. <ColumnDefinition Width="40.5" />
  114. <ColumnDefinition Width="40.5" />
  115. </Grid.ColumnDefinitions>
  116. <RadioButton
  117. x:Name="SharpRectBtn"
  118. Width="32"
  119. Height="32"
  120. Margin="0,0"
  121. Padding="7,0,0,0"
  122. VerticalContentAlignment="Center"
  123. Background="Transparent"
  124. GroupName="Shape"
  125. IsChecked="{Binding IsRect}"
  126. Style="{DynamicResource GreyBgRadioBtnStyle}"
  127. Tag="Rect"
  128. ToolTip="矩形">
  129. <RadioButton.Content>
  130. <Rectangle
  131. Width="16"
  132. Height="16"
  133. HorizontalAlignment="Center"
  134. VerticalAlignment="Center"
  135. Stroke="#273C62" />
  136. </RadioButton.Content>
  137. <i:Interaction.Triggers>
  138. <i:EventTrigger EventName="Checked">
  139. <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpRectBtn, Path=Tag}" />
  140. </i:EventTrigger>
  141. </i:Interaction.Triggers>
  142. </RadioButton>
  143. <RadioButton
  144. x:Name="SharpCircleBtn"
  145. Grid.Column="1"
  146. Width="32"
  147. Height="32"
  148. Margin="0,0"
  149. Padding="7,0,0,0"
  150. VerticalContentAlignment="Center"
  151. Background="Transparent"
  152. GroupName="Shape"
  153. IsChecked="{Binding IsCircle}"
  154. Style="{DynamicResource GreyBgRadioBtnStyle}"
  155. Tag="Circle"
  156. ToolTip="圆">
  157. <RadioButton.Content>
  158. <Ellipse
  159. Width="16"
  160. Height="16"
  161. HorizontalAlignment="Center"
  162. VerticalAlignment="Center"
  163. Stroke="#273C62" />
  164. </RadioButton.Content>
  165. <i:Interaction.Triggers>
  166. <i:EventTrigger EventName="Checked">
  167. <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpCircleBtn, Path=Tag}" />
  168. </i:EventTrigger>
  169. </i:Interaction.Triggers>
  170. </RadioButton>
  171. <RadioButton
  172. x:Name="SharpArrowBtn"
  173. Grid.Column="2"
  174. Width="32"
  175. Height="32"
  176. Margin="0,0"
  177. Padding="7,0,0,0"
  178. VerticalContentAlignment="Center"
  179. Background="Transparent"
  180. GroupName="Shape"
  181. IsChecked="{Binding IsArrow}"
  182. Style="{DynamicResource GreyBgRadioBtnStyle}"
  183. Tag="Arrow"
  184. ToolTip="箭头">
  185. <RadioButton.Content>
  186. <Path
  187. Width="16"
  188. Height="16"
  189. HorizontalAlignment="Center"
  190. VerticalAlignment="Center"
  191. Fill="#273C62">
  192. <Path.Data>
  193. 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
  194. </Path.Data>
  195. </Path>
  196. </RadioButton.Content>
  197. <i:Interaction.Triggers>
  198. <i:EventTrigger EventName="Checked">
  199. <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpArrowBtn, Path=Tag}" />
  200. </i:EventTrigger>
  201. </i:Interaction.Triggers>
  202. </RadioButton>
  203. <RadioButton
  204. x:Name="SharpLineBtn"
  205. Grid.Column="3"
  206. Width="32"
  207. Height="32"
  208. Margin="0,0"
  209. Padding="7,8,0,0"
  210. Background="Transparent"
  211. GroupName="Shape"
  212. IsChecked="{Binding IsLine}"
  213. Style="{DynamicResource GreyBgRadioBtnStyle}"
  214. Tag="Line"
  215. ToolTip="线条">
  216. <RadioButton.Content>
  217. <Polygon
  218. Width="16"
  219. Height="16"
  220. HorizontalAlignment="Center"
  221. VerticalAlignment="Center"
  222. Fill="#273C62">
  223. <Polygon.Points>
  224. 13.1757359 1.97573593 14.0242641 2.82426407 2.82426407 14.0242641 1.97573593 13.1757359
  225. </Polygon.Points>
  226. </Polygon>
  227. </RadioButton.Content>
  228. <i:Interaction.Triggers>
  229. <i:EventTrigger EventName="Checked">
  230. <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpLineBtn, Path=Tag}" />
  231. </i:EventTrigger>
  232. </i:Interaction.Triggers>
  233. </RadioButton>
  234. </Grid>
  235. </Border>
  236. <Grid
  237. x:Name="GridFill"
  238. Margin="0,18,0,0"
  239. Visibility="{Binding IsLineAnnot, Converter={StaticResource InvertBoolToVisibleConvert}}">
  240. <Grid.RowDefinitions>
  241. <RowDefinition Height="auto" />
  242. <RowDefinition />
  243. </Grid.RowDefinitions>
  244. <TextBlock
  245. VerticalAlignment="Center"
  246. Foreground="{StaticResource color.sys.text.neutral.lv2}"
  247. Text="Fill" />
  248. <CompositeControl:SlidContent
  249. x:Name="layerFill"
  250. HorizontalAlignment="Right"
  251. InitValue="{Binding BasicVm.FillOpacity, Mode=OneWay}"
  252. Visibility="{Binding BasicVm.IsMultiSelected, Converter={StaticResource InvertBoolToVisibleConvert}}">
  253. <i:Interaction.Triggers>
  254. <i:EventTrigger EventName="SelectedValueChanged">
  255. <i:InvokeCommandAction Command="{Binding SelectedOpacityValueCommand}" CommandParameter="{Binding ElementName=layerFill, Path=Value}" />
  256. </i:EventTrigger>
  257. </i:Interaction.Triggers>
  258. </CompositeControl:SlidContent>
  259. <CompositeControl:ColorContent
  260. x:Name="cusFillColor"
  261. Grid.Row="1"
  262. Margin="0,8,0,0"
  263. ColorType="Fill"
  264. ItemSource="{Binding BasicVm.FillColorItems}"
  265. UIColor="{Binding BasicVm.CurrentFillColor, Mode=OneWay}">
  266. <i:Interaction.Triggers>
  267. <i:EventTrigger EventName="SelectedColorInvoke">
  268. <i:InvokeCommandAction Command="{Binding SelectedFillColorCommand}" CommandParameter="{Binding ElementName=cusFillColor, Path=SelectedColor}" />
  269. </i:EventTrigger>
  270. </i:Interaction.Triggers>
  271. </CompositeControl:ColorContent>
  272. </Grid>
  273. <Grid Margin="0,18,0,0">
  274. <Grid.RowDefinitions>
  275. <RowDefinition Height="auto" />
  276. <RowDefinition />
  277. </Grid.RowDefinitions>
  278. <TextBlock
  279. VerticalAlignment="Center"
  280. Foreground="{StaticResource color.sys.text.neutral.lv2}"
  281. Text="Border" />
  282. <CompositeControl:SlidContent
  283. x:Name="layerThick"
  284. HorizontalAlignment="Right"
  285. InitValue="{Binding BasicVm.FillOpacity, Mode=OneWay}"
  286. Visibility="{Binding BasicVm.IsMultiSelected, Converter={StaticResource InvertBoolToVisibleConvert}}">
  287. <i:Interaction.Triggers>
  288. <i:EventTrigger EventName="SelectedValueChanged">
  289. <i:InvokeCommandAction Command="{Binding SelectedOpacityValueCommand}" CommandParameter="{Binding ElementName=layerThick, Path=Value}" />
  290. </i:EventTrigger>
  291. </i:Interaction.Triggers>
  292. </CompositeControl:SlidContent>
  293. <CompositeControl:ColorContent
  294. x:Name="cusColor"
  295. Grid.Row="1"
  296. Margin="0,8,0,0"
  297. ColorType="Border"
  298. ItemSource="{Binding BasicVm.ColorItems}"
  299. UIColor="{Binding BasicVm.CurrentBorderColor, Mode=OneWay}">
  300. <i:Interaction.Triggers>
  301. <i:EventTrigger EventName="SelectedColorInvoke">
  302. <i:InvokeCommandAction Command="{Binding SelectedBorderColorCommand}" CommandParameter="{Binding ElementName=cusColor, Path=SelectedColor}" />
  303. </i:EventTrigger>
  304. </i:Interaction.Triggers>
  305. </CompositeControl:ColorContent>
  306. </Grid>
  307. <CompositeControl:SlidComboControl
  308. x:Name="thickness"
  309. Margin="0,0,0,0"
  310. ItemsSource="{Binding ThicknessItems}"
  311. Value="{Binding BasicVm.AnnotThickness, Mode=TwoWay}">
  312. <i:Interaction.Triggers>
  313. <i:EventTrigger EventName="ValueChanged">
  314. <i:InvokeCommandAction Command="{Binding SelectedThickCommand}" CommandParameter="{Binding ElementName=thickness, Path=Value}" />
  315. </i:EventTrigger>
  316. </i:Interaction.Triggers>
  317. </CompositeControl:SlidComboControl>
  318. <StackPanel
  319. x:Name="PnlLineStyle"
  320. Margin="0,20,0,0"
  321. Orientation="Horizontal">
  322. <RadioButton
  323. x:Name="BtnSolid"
  324. Width="105"
  325. Height="32"
  326. Margin="0,0,10,0"
  327. VerticalContentAlignment="Center"
  328. Background="Transparent"
  329. Command="{Binding LineStyleCommand}"
  330. CommandParameter="{Binding ElementName=BtnSolid, Path=Tag}"
  331. Foreground="#616469"
  332. GroupName="LineMode"
  333. IsChecked="{Binding BasicVm.IsSolidLine}"
  334. Style="{DynamicResource GreyBgRadioBtnStyle}"
  335. Tag="Solid">
  336. <RadioButton.Content>
  337. <Line
  338. Stroke="Black"
  339. StrokeThickness="2"
  340. X1="10"
  341. X2="90"
  342. Y1="5"
  343. Y2="5" />
  344. </RadioButton.Content>
  345. </RadioButton>
  346. <RadioButton
  347. x:Name="BtnDashed"
  348. Width="105"
  349. Height="32"
  350. Margin="0,0"
  351. VerticalContentAlignment="Center"
  352. Background="Transparent"
  353. Command="{Binding LineStyleCommand}"
  354. CommandParameter="{Binding ElementName=BtnDashed, Path=Tag}"
  355. Foreground="#616469"
  356. GroupName="LineMode"
  357. IsChecked="{Binding BasicVm.IsDashLine}"
  358. Style="{DynamicResource GreyBgRadioBtnStyle}"
  359. Tag="Dashed">
  360. <RadioButton.Content>
  361. <Line
  362. Stroke="Black"
  363. StrokeDashArray="2"
  364. StrokeThickness="2"
  365. X1="10"
  366. X2="90"
  367. Y1="5"
  368. Y2="5" />
  369. </RadioButton.Content>
  370. </RadioButton>
  371. </StackPanel>
  372. </StackPanel>
  373. </Grid>
  374. </UserControl>