SharpsAnnotProperty.xaml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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 Background="#F3F3F3">
  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="1"
  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. <ToggleButton
  115. Name="SharpRectBtn"
  116. Width="40.5"
  117. Background="Transparent"
  118. BorderThickness="0"
  119. Click="SharpsBtn_Click"
  120. Command="{Binding SharpsTypeCommand}"
  121. CommandParameter="{Binding ElementName=SharpRectBtn, Path=Tag}"
  122. Tag="Rect">
  123. <Rectangle
  124. Width="16"
  125. Height="16"
  126. HorizontalAlignment="Center"
  127. VerticalAlignment="Center"
  128. Stroke="#273C62" />
  129. </ToggleButton>
  130. <Line
  131. Name="line1"
  132. Grid.Column="1"
  133. HorizontalAlignment="Left"
  134. VerticalAlignment="Center"
  135. Stroke="#33000000"
  136. StrokeThickness="1"
  137. X1="0"
  138. X2="0"
  139. Y1="0"
  140. Y2="16" />
  141. <ToggleButton
  142. Name="SharpCircleBtn"
  143. Grid.Column="1"
  144. Width="40.5"
  145. Margin="0,0,0,0"
  146. Background="Transparent"
  147. BorderThickness="0"
  148. Click="SharpsBtn_Click"
  149. Command="{Binding SharpsTypeCommand}"
  150. CommandParameter="{Binding ElementName=SharpCircleBtn, Path=Tag}"
  151. Tag="Circle">
  152. <Ellipse
  153. Width="16"
  154. Height="16"
  155. HorizontalAlignment="Center"
  156. VerticalAlignment="Center"
  157. Stroke="#273C62" />
  158. </ToggleButton>
  159. <Line
  160. Name="line2"
  161. Grid.Column="2"
  162. HorizontalAlignment="Left"
  163. VerticalAlignment="Center"
  164. Stroke="#33000000"
  165. StrokeThickness="1"
  166. Style="{StaticResource line2Style}"
  167. X1="0"
  168. X2="0"
  169. Y1="0"
  170. Y2="16" />
  171. <ToggleButton
  172. Name="SharpArrowBtn"
  173. Grid.Column="2"
  174. Width="40.5"
  175. Background="Transparent"
  176. BorderThickness="0"
  177. Click="SharpsBtn_Click"
  178. Command="{Binding SharpsTypeCommand}"
  179. CommandParameter="{Binding ElementName=SharpArrowBtn, Path=Tag}"
  180. Tag="Arrow">
  181. <Path
  182. Width="16"
  183. Height="16"
  184. HorizontalAlignment="Center"
  185. VerticalAlignment="Center"
  186. Fill="#273C62">
  187. <Path.Data>
  188. 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
  189. </Path.Data>
  190. </Path>
  191. </ToggleButton>
  192. <Line
  193. x:Name="line3"
  194. Grid.Column="3"
  195. HorizontalAlignment="Left"
  196. VerticalAlignment="Center"
  197. Stroke="#33000000"
  198. StrokeThickness="1"
  199. Style="{StaticResource line3Style}"
  200. X1="0"
  201. X2="0"
  202. Y1="0"
  203. Y2="16" />
  204. <ToggleButton
  205. Name="SharpLineBtn"
  206. Grid.Column="3"
  207. Width="40.5"
  208. Background="Transparent"
  209. BorderThickness="0"
  210. Click="SharpsBtn_Click"
  211. Command="{Binding SharpsTypeCommand}"
  212. CommandParameter="{Binding ElementName=SharpLineBtn, Path=Tag}"
  213. Tag="Line">
  214. <Polygon
  215. Width="16"
  216. Height="16"
  217. HorizontalAlignment="Center"
  218. VerticalAlignment="Center"
  219. Fill="#273C62">
  220. <Polygon.Points>
  221. 13.1757359 1.97573593 14.0242641 2.82426407 2.82426407 14.0242641 1.97573593 13.1757359
  222. </Polygon.Points>
  223. </Polygon>
  224. </ToggleButton>
  225. </Grid>
  226. </Border>
  227. <Grid x:Name="GridFill" Margin="0,18,0,0">
  228. <Grid.RowDefinitions>
  229. <RowDefinition Height="auto" />
  230. <RowDefinition />
  231. </Grid.RowDefinitions>
  232. <TextBlock Text="Fill" VerticalAlignment="Center"/>
  233. <CompositeControl:SlidContent x:Name="layerFill" HorizontalAlignment="Right"
  234. InitValue="{Binding BasicVm.FillOpacity,Mode=OneWay}"
  235. Visibility="{Binding BasicVm.IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}"
  236. >
  237. <i:Interaction.Triggers>
  238. <i:EventTrigger EventName="SelectedValueChanged">
  239. <i:InvokeCommandAction Command="{Binding SelectedOpacityValueCommand}" CommandParameter="{Binding ElementName=layerFill,Path=Value}"/>
  240. </i:EventTrigger>
  241. </i:Interaction.Triggers>
  242. </CompositeControl:SlidContent>
  243. <CompositeControl:ColorContent x:Name="cusFillColor" Grid.Row="1"
  244. UIColor="{Binding BasicVm.CurrentFillColor,Mode=OneWay}" >
  245. <i:Interaction.Triggers>
  246. <i:EventTrigger EventName="SelectedColorInvoke">
  247. <i:InvokeCommandAction Command="{Binding SelectedFillColorCommand}" CommandParameter="{Binding ElementName=cusFillColor,Path=SelectedColor}"/>
  248. </i:EventTrigger>
  249. </i:Interaction.Triggers>
  250. </CompositeControl:ColorContent>
  251. </Grid>
  252. <Grid Margin="0,18,0,0">
  253. <Grid.RowDefinitions>
  254. <RowDefinition Height="auto" />
  255. <RowDefinition />
  256. </Grid.RowDefinitions>
  257. <TextBlock Text="Border" VerticalAlignment="Center"/>
  258. <CompositeControl:SlidContent x:Name="layerThick" HorizontalAlignment="Right"
  259. InitValue="{Binding BasicVm.BorderOpacity,Mode=OneWay}"
  260. Visibility="{Binding BasicVm.IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}"
  261. />
  262. <CompositeControl:ColorContent x:Name="cusColor" Grid.Row="1"
  263. UIColor="{Binding BasicVm.CurrentBorderColor,Mode=OneWay}" >
  264. <i:Interaction.Triggers>
  265. <i:EventTrigger EventName="SelectedColorInvoke">
  266. <i:InvokeCommandAction Command="{Binding SelectedBorderColorCommand}" CommandParameter="{Binding ElementName=cusColor,Path=SelectedColor}"/>
  267. </i:EventTrigger>
  268. </i:Interaction.Triggers>
  269. </CompositeControl:ColorContent>
  270. </Grid>
  271. <CompositeControl:SlidComboControl x:Name="thickness" Margin="12,0,12,0" Value="{Binding BasicVm.AnnotThickness,Mode=TwoWay}">
  272. <i:Interaction.Triggers>
  273. <i:EventTrigger EventName="ValueChanged">
  274. <i:InvokeCommandAction Command="{Binding SelectedThickCommand}" CommandParameter="{Binding ElementName=thickness,Path=Value}"/>
  275. </i:EventTrigger>
  276. </i:Interaction.Triggers>
  277. </CompositeControl:SlidComboControl>
  278. <!--<Grid>
  279. <Grid.ColumnDefinitions>
  280. <ColumnDefinition Width="*" />
  281. <ColumnDefinition Width="auto" />
  282. </Grid.ColumnDefinitions>
  283. <Slider
  284. Name="BorderSlider"
  285. Margin="12,0,4,0"
  286. VerticalAlignment="Center"
  287. IsMoveToPointEnabled="True"
  288. IsSelectionRangeEnabled="True"
  289. IsSnapToTickEnabled="True"
  290. Maximum="12"
  291. Minimum="1"
  292. Style="{StaticResource RoundThumbSlider}"
  293. TickFrequency="1"
  294. Value="{Binding LineWidth}">
  295. <Slider.Resources>
  296. <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#477EDE" />
  297. <SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#E2E3E6" />
  298. </Slider.Resources>
  299. </Slider>
  300. <Border
  301. Grid.Column="1"
  302. Width="80"
  303. Height="32"
  304. Margin="0,0,12,0"
  305. BorderBrush="#E2E3E6"
  306. BorderThickness="0">
  307. <Grid>
  308. <ComboBox
  309. Name="BorderDropBox"
  310. Padding="10,10,0,0"
  311. Background="Transparent"
  312. BorderBrush="#FFE2E3E6"
  313. BorderThickness="1">
  314. <ComboBox.ItemContainerStyle>
  315. <Style TargetType="{x:Type ComboBoxItem}">
  316. <Setter Property="Padding" Value="10,0,0,0" />
  317. </Style>
  318. </ComboBox.ItemContainerStyle>
  319. <ComboBoxItem
  320. Height="32"
  321. VerticalContentAlignment="Center"
  322. Content="1"
  323. Template="{StaticResource comboxitem}" />
  324. <ComboBoxItem
  325. Height="32"
  326. VerticalContentAlignment="Center"
  327. Content="3"
  328. Template="{StaticResource comboxitem}" />
  329. <ComboBoxItem
  330. Height="32"
  331. VerticalContentAlignment="Center"
  332. Content="6"
  333. Template="{StaticResource comboxitem}" />
  334. <ComboBoxItem
  335. Height="32"
  336. VerticalContentAlignment="Center"
  337. Content="9"
  338. Template="{StaticResource comboxitem}" />
  339. <ComboBoxItem
  340. Height="32"
  341. VerticalContentAlignment="Center"
  342. Content="12"
  343. Template="{StaticResource comboxitem}" />
  344. <i:Interaction.Triggers>
  345. <i:EventTrigger EventName="SelectionChanged">
  346. <i:InvokeCommandAction Command="{Binding ThicknessChangedCommand}" CommandParameter="{Binding ElementName=BorderDropBox, Path=SelectedItem}" />
  347. </i:EventTrigger>
  348. </i:Interaction.Triggers>
  349. </ComboBox>
  350. <TextBox
  351. Height="20"
  352. Margin="10,0,35,0"
  353. VerticalAlignment="Center"
  354. Background="White"
  355. BorderThickness="0"
  356. FontFamily="Segoe UI"
  357. FontSize="14"
  358. IsReadOnly="True"
  359. Text="{Binding ElementName=BorderSlider, Path=Value}"
  360. TextAlignment="Left" />
  361. </Grid>
  362. </Border>
  363. </Grid>-->
  364. <StackPanel x:Name="PnlLineStyle" Orientation="Horizontal" Margin="0,20,0,0">
  365. <RadioButton x:Name="BtnSolid" Tag="Solid" GroupName="LineMode"
  366. Width="105" Height="32" Margin="0,0,10,0" Foreground="#616469"
  367. VerticalContentAlignment="Center" Background="Transparent"
  368. Style="{DynamicResource GreyBgRadioBtnStyle}">
  369. <RadioButton.Content>
  370. <Line X1="10" Y1="5" X2="90" Y2="5" Stroke="Black" StrokeThickness="2" />
  371. </RadioButton.Content>
  372. <i:Interaction.Triggers>
  373. <i:EventTrigger EventName="Checked">
  374. <i:InvokeCommandAction Command="{Binding LineStyleCommand}" CommandParameter="{Binding ElementName=BtnSolid, Path=Tag}" />
  375. </i:EventTrigger>
  376. </i:Interaction.Triggers>
  377. </RadioButton>
  378. <RadioButton x:Name="BtnDashed" Tag="Dashed" GroupName="LineMode"
  379. Width="105" Height="32" Margin="0,0" Foreground="#616469"
  380. VerticalContentAlignment="Center" Background="Transparent"
  381. Style="{DynamicResource GreyBgRadioBtnStyle}">
  382. <RadioButton.Content>
  383. <Line X1="10" Y1="5" X2="90" Y2="5" Stroke="Black" StrokeThickness="2" StrokeDashArray="2"/>
  384. </RadioButton.Content>
  385. <i:Interaction.Triggers>
  386. <i:EventTrigger EventName="Checked">
  387. <i:InvokeCommandAction Command="{Binding LineStyleCommand}" CommandParameter="{Binding ElementName=BtnDashed, Path=Tag}" />
  388. </i:EventTrigger>
  389. </i:Interaction.Triggers>
  390. </RadioButton>
  391. </StackPanel>
  392. </StackPanel>
  393. </Grid>
  394. </UserControl>