SharpsAnnotProperty.xaml 17 KB

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