SharpsAnnotProperty.xaml 19 KB

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