SharpsAnnotProperty.xaml 17 KB

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