TextEditProperty.xaml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <UserControl
  2. x:Class="PDF_Master.Views.PropertyPanel.PDFEdit.TextEditProperty"
  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:FormControl="clr-namespace:PDF_Master.CustomControl.Form"
  8. xmlns:cus="clr-namespace:PDF_Master.CustomControl"
  9. xmlns:cusColor="clr-namespace:PDF_Master.CustomControl.CompositeControl"
  10. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  11. xmlns:form="clr-namespace:PDF_Master.CustomControl.Form"
  12. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  13. xmlns:local="clr-namespace:PDF_Master.Views.PropertyPanel"
  14. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  15. xmlns:pdfedit="clr-namespace:PDF_Master.Views.PropertyPanel.PDFEdit"
  16. xmlns:prism="http://prismlibrary.com/"
  17. d:DesignHeight="450"
  18. d:DesignWidth="260"
  19. prism:ViewModelLocator.AutoWireViewModel="True"
  20. Background="{StaticResource color.sys.layout.mg}"
  21. Loaded="UserControl_Loaded"
  22. mc:Ignorable="d">
  23. <UserControl.Resources>
  24. <ResourceDictionary>
  25. <ResourceDictionary.MergedDictionaries>
  26. <ResourceDictionary Source="../../../Styles/SliderStyle.xaml" />
  27. <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml" />
  28. <ResourceDictionary Source="../../../Styles/RadioButtonStyle.xaml" />
  29. </ResourceDictionary.MergedDictionaries>
  30. <Convert:BoolToVisible x:Key="BoolToVisible" />
  31. <Convert:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert" />
  32. <Convert:InvertBoolConvert x:Key="InvertBoolConvert" />
  33. <DataTemplate x:Key="FontStyleData">
  34. <Grid>
  35. <TextBlock Foreground="Black" Text="{Binding mFontStyleName}" />
  36. </Grid>
  37. </DataTemplate>
  38. </ResourceDictionary>
  39. </UserControl.Resources>
  40. <Grid Margin="16,14">
  41. <Grid.RowDefinitions>
  42. <RowDefinition Height="Auto" />
  43. <RowDefinition Height="Auto" />
  44. </Grid.RowDefinitions>
  45. <Grid>
  46. <StackPanel>
  47. <TextBlock
  48. Name="AnnotTypeTitle"
  49. HorizontalAlignment="Left"
  50. FontFamily="Segoe UI"
  51. FontSize="14"
  52. FontWeight="SemiBold"
  53. LineHeight="22">
  54. Edit Text
  55. </TextBlock>
  56. <Border
  57. Width="228"
  58. Height="88"
  59. Margin="0,8"
  60. Background="{StaticResource color.field.bg.def}"
  61. BorderBrush="{StaticResource color.field.border.norm}"
  62. BorderThickness="1"
  63. CornerRadius="2">
  64. <Grid>
  65. <Border
  66. Name="FreeTextBorder"
  67. Padding="5"
  68. HorizontalAlignment="Center"
  69. VerticalAlignment="Center">
  70. <TextBlock
  71. Name="SampleText"
  72. HorizontalAlignment="Center"
  73. VerticalAlignment="Center"
  74. FontFamily="{Binding CurrentFontFamily.ValueStr}"
  75. FontSize="{Binding CurrentFontSize.Value}"
  76. FontStyle="{Binding FontStyleItem}"
  77. FontWeight="{Binding FontWeightItem}"
  78. Foreground="{Binding SelectColor}"
  79. Text="Sample" />
  80. </Border>
  81. <Path
  82. Name="UnderlinePath"
  83. Margin="0,51,0,0"
  84. HorizontalAlignment="Center"
  85. StrokeThickness="2"
  86. Visibility="Collapsed">
  87. <Path.Data>
  88. <LineGeometry StartPoint="0,0" EndPoint="62,0" />
  89. </Path.Data>
  90. </Path>
  91. <Path
  92. Name="StrikeoutPath"
  93. Margin="0,40,0,0"
  94. HorizontalAlignment="Center"
  95. StrokeThickness="2"
  96. Visibility="Collapsed">
  97. <Path.Data>
  98. <LineGeometry StartPoint="0,0" EndPoint="62,0" />
  99. </Path.Data>
  100. </Path>
  101. <Path
  102. Name="SquigglyPath"
  103. Margin="0,51,0,0"
  104. HorizontalAlignment="Center"
  105. StrokeThickness="2"
  106. Visibility="Collapsed" />
  107. </Grid>
  108. </Border>
  109. <Border
  110. Height="32"
  111. Margin="0,8,0,18"
  112. BorderBrush="#E2E3E6"
  113. BorderThickness="0">
  114. <Grid>
  115. <CompositeControl:CustomComboControl
  116. x:Name="FontTitleBox"
  117. Width="188"
  118. Title="{Binding Title, Mode=TwoWay, NotifyOnSourceUpdated=True}"
  119. Height="32"
  120. HorizontalAlignment="Left"
  121. IsSelectedEmpty="{Binding IsSelectedEmpty}"
  122. IsValueContent="True"
  123. ItemSource="{Binding PresetFontItems, Mode=OneWay}"
  124. SelectedIndex="{Binding PresetFontSelectedIndex, Mode=TwoWay}"
  125. SelectedItems="{Binding CurrentPresetFont, Mode=TwoWay}">
  126. <i:Interaction.Triggers>
  127. <i:EventTrigger EventName="ValueChanged">
  128. <i:InvokeCommandAction Command="{Binding SelectedPresetFontCommand}" />
  129. </i:EventTrigger>
  130. </i:Interaction.Triggers>
  131. </CompositeControl:CustomComboControl>
  132. <Button
  133. Width="32"
  134. Height="32"
  135. HorizontalAlignment="Right"
  136. Command="{Binding CustomFontStyleCommand}"
  137. Style="{StaticResource btn.sec}">
  138. <Path
  139. Width="16"
  140. Height="16"
  141. Data="M4 8C4 8.82843 3.32843 9.5 2.5 9.5C1.67157 9.5 1 8.82843 1 8C1 7.17157 1.67157 6.5 2.5 6.5C3.32843 6.5 4 7.17157 4 8ZM9.3999 8C9.3999 8.82843 8.72833 9.5 7.8999 9.5C7.07148 9.5 6.3999 8.82843 6.3999 8C6.3999 7.17157 7.07148 6.5 7.8999 6.5C8.72833 6.5 9.3999 7.17157 9.3999 8ZM13.5 9.5C14.3284 9.5 15 8.82843 15 8C15 7.17157 14.3284 6.5 13.5 6.5C12.6716 6.5 12 7.17157 12 8C12 8.82843 12.6716 9.5 13.5 9.5Z"
  142. Fill="{StaticResource color.icon.base.neutral.norm.lv1}" />
  143. </Button>
  144. </Grid>
  145. </Border>
  146. <StackPanel>
  147. <TextBlock
  148. Margin="0,0,0,10"
  149. Style="{StaticResource PropertyHeaderLv2}"
  150. Text="Font" />
  151. <StackPanel>
  152. <CompositeControl:CustomComboControl
  153. x:Name="FontFamilyBox"
  154. Height="32"
  155. IsSelectedEmpty="{Binding IsSelectedEmpty}"
  156. IsValueContent="True"
  157. ItemSource="{Binding FontFamilyItems, Mode=OneWay}"
  158. SelectedIndex="{Binding FontFamilySelectedIndex, Mode=TwoWay}"
  159. SelectedItems="{Binding CurrentFontFamily, Mode=TwoWay}">
  160. <i:Interaction.Triggers>
  161. <i:EventTrigger EventName="ValueChanged">
  162. <i:InvokeCommandAction Command="{Binding FontFamilyChangedCommand}" />
  163. </i:EventTrigger>
  164. </i:Interaction.Triggers>
  165. </CompositeControl:CustomComboControl>
  166. <Grid Margin="0,8">
  167. <CompositeControl:CustomComboControl
  168. x:Name="FontStyleBox"
  169. Width="110"
  170. Height="32"
  171. HorizontalAlignment="Left"
  172. IsSelectedEmpty="{Binding IsSelectedEmpty}"
  173. IsValueContent="True"
  174. ItemSource="{Binding FontStyleItems, Mode=OneWay}"
  175. SelectedIndex="{Binding FontStyleSelectedIndex, Mode=TwoWay}"
  176. SelectedItems="{Binding CurrrentFontWeightStyle, Mode=TwoWay}">
  177. <i:Interaction.Triggers>
  178. <i:EventTrigger EventName="ValueChanged">
  179. <i:InvokeCommandAction Command="{Binding FontStyleWeightChangedCommand}" />
  180. </i:EventTrigger>
  181. </i:Interaction.Triggers>
  182. </CompositeControl:CustomComboControl>
  183. <CompositeControl:CustomComboControl
  184. x:Name="FontSizeBox"
  185. Width="110"
  186. Height="32"
  187. HorizontalAlignment="Right"
  188. IsSelectedEmpty="{Binding IsSelectedEmpty}"
  189. ItemSource="{Binding FontSizeItems, Mode=OneWay}"
  190. SelectedIndex="{Binding FontSizeSelectedIndex, Mode=TwoWay}"
  191. SelectedItems="{Binding CurrentFontSize, Mode=TwoWay}">
  192. <i:Interaction.Triggers>
  193. <i:EventTrigger EventName="ValueChanged">
  194. <i:InvokeCommandAction Command="{Binding FontSizeChangedCommand}" />
  195. </i:EventTrigger>
  196. </i:Interaction.Triggers>
  197. </CompositeControl:CustomComboControl>
  198. </Grid>
  199. <Grid>
  200. <StackPanel Orientation="Horizontal">
  201. <RadioButton
  202. x:Name="TextAlignLeftBtn"
  203. Width="32"
  204. Margin="8,0"
  205. Height="32"
  206. VerticalContentAlignment="Center"
  207. Background="Transparent"
  208. Foreground="#616469"
  209. GroupName="TextAlign"
  210. IsChecked="True"
  211. Style="{DynamicResource GreyBgRadioBtnStyle}"
  212. Tag="AlignLeft" VerticalAlignment="Bottom">
  213. <RadioButton.Content>
  214. <Grid Width="32" Height="32">
  215. <Canvas Margin="5,10,0,0">
  216. <Rectangle
  217. Canvas.Top="0.25"
  218. Width="14"
  219. Height="1.5"
  220. Stroke="{Binding ElementName=TextAlignLeftBtn, Path=Foreground}"
  221. StrokeThickness="1.5" />
  222. <Rectangle
  223. Canvas.Top="4.25"
  224. Width="8"
  225. Height="1.5"
  226. Stroke="{Binding ElementName=TextAlignLeftBtn, Path=Foreground}"
  227. StrokeThickness="1.5" />
  228. <Rectangle
  229. Canvas.Top="12.25"
  230. Width="8"
  231. Height="1.5"
  232. Stroke="{Binding ElementName=TextAlignLeftBtn, Path=Foreground}"
  233. StrokeThickness="1.5" />
  234. <Rectangle
  235. Canvas.Top="8.25"
  236. Width="14"
  237. Height="1.5"
  238. Stroke="{Binding ElementName=TextAlignLeftBtn, Path=Foreground}"
  239. StrokeThickness="1.5" />
  240. </Canvas>
  241. </Grid>
  242. </RadioButton.Content>
  243. <i:Interaction.Triggers>
  244. <i:EventTrigger EventName="Checked">
  245. <i:InvokeCommandAction Command="{Binding TextAlignCheckedCommand}" CommandParameter="{Binding ElementName=TextAlignLeftBtn, Path=Tag}" />
  246. </i:EventTrigger>
  247. </i:Interaction.Triggers>
  248. </RadioButton>
  249. <RadioButton
  250. x:Name="TextAlignCenterBtn"
  251. Width="32"
  252. Height="32"
  253. Margin="8,0"
  254. VerticalContentAlignment="Center"
  255. Background="Transparent"
  256. Foreground="#616469"
  257. GroupName="TextAlign"
  258. Style="{DynamicResource GreyBgRadioBtnStyle}"
  259. Tag="AlignCenter">
  260. <RadioButton.Content>
  261. <Grid Width="32" Height="32">
  262. <Canvas Margin="5,10,0,0">
  263. <Rectangle
  264. Canvas.Top="0.25"
  265. Width="14"
  266. Height="1.5"
  267. Stroke="{Binding ElementName=TextAlignCenterBtn, Path=Foreground}"
  268. StrokeThickness="1.5" />
  269. <Rectangle
  270. Canvas.Left="3"
  271. Canvas.Top="4.25"
  272. Width="8"
  273. Height="1.5"
  274. Stroke="{Binding ElementName=TextAlignCenterBtn, Path=Foreground}"
  275. StrokeThickness="1.5" />
  276. <Rectangle
  277. Canvas.Left="3"
  278. Canvas.Top="12.25"
  279. Width="8"
  280. Height="1.5"
  281. Stroke="{Binding ElementName=TextAlignCenterBtn, Path=Foreground}"
  282. StrokeThickness="1.5" />
  283. <Rectangle
  284. Canvas.Top="8.25"
  285. Width="14"
  286. Height="1.5"
  287. Stroke="{Binding ElementName=TextAlignCenterBtn, Path=Foreground}"
  288. StrokeThickness="1.5" />
  289. </Canvas>
  290. </Grid>
  291. </RadioButton.Content>
  292. <i:Interaction.Triggers>
  293. <i:EventTrigger EventName="Checked">
  294. <i:InvokeCommandAction Command="{Binding TextAlignCheckedCommand}" CommandParameter="{Binding ElementName=TextAlignCenterBtn, Path=Tag}" />
  295. </i:EventTrigger>
  296. </i:Interaction.Triggers>
  297. </RadioButton>
  298. <RadioButton
  299. x:Name="TextAlignRightBtn"
  300. Grid.Column="2"
  301. Width="32"
  302. Margin="8,0"
  303. Height="32"
  304. VerticalContentAlignment="Center"
  305. Background="Transparent"
  306. Foreground="#616469"
  307. GroupName="TextAlign"
  308. Style="{DynamicResource GreyBgRadioBtnStyle}"
  309. Tag="AlignRight">
  310. <RadioButton.Content>
  311. <Grid Width="32" Height="32">
  312. <Canvas Margin="5,10,0,0">
  313. <Rectangle
  314. Canvas.Top="0.25"
  315. Width="14"
  316. Height="1.5"
  317. Stroke="{Binding ElementName=TextAlignRightBtn, Path=Foreground}"
  318. StrokeThickness="1.5" />
  319. <Rectangle
  320. Canvas.Left="6"
  321. Canvas.Top="4.25"
  322. Width="8"
  323. Height="1.5"
  324. Stroke="{Binding ElementName=TextAlignRightBtn, Path=Foreground}"
  325. StrokeThickness="1.5" />
  326. <Rectangle
  327. Canvas.Left="6"
  328. Canvas.Top="12.25"
  329. Width="8"
  330. Height="1.5"
  331. Stroke="{Binding ElementName=TextAlignRightBtn, Path=Foreground}"
  332. StrokeThickness="1.5" />
  333. <Rectangle
  334. Canvas.Top="8.25"
  335. Width="14"
  336. Height="1.5"
  337. Stroke="{Binding ElementName=TextAlignRightBtn, Path=Foreground}"
  338. StrokeThickness="1.5" />
  339. </Canvas>
  340. </Grid>
  341. </RadioButton.Content>
  342. <i:Interaction.Triggers>
  343. <i:EventTrigger EventName="Checked">
  344. <i:InvokeCommandAction Command="{Binding TextAlignCheckedCommand}" CommandParameter="{Binding ElementName=TextAlignRightBtn, Path=Tag}" />
  345. </i:EventTrigger>
  346. </i:Interaction.Triggers>
  347. </RadioButton>
  348. <RadioButton
  349. x:Name="TextAlignBtn"
  350. Grid.Column="3"
  351. Width="32"
  352. Visibility="Collapsed"
  353. Height="32"
  354. Margin="8,0"
  355. VerticalContentAlignment="Center"
  356. Background="Transparent"
  357. Foreground="#616469"
  358. GroupName="TextAlign"
  359. Style="{DynamicResource GreyBgRadioBtnStyle}"
  360. Tag="Align">
  361. <RadioButton.Content>
  362. <Grid Width="32" Height="32">
  363. <Canvas Margin="5,10,0,0">
  364. <Rectangle
  365. Canvas.Top="0.25"
  366. Width="14"
  367. Height="1.5"
  368. Stroke="{Binding ElementName=TextAlignBtn, Path=Foreground}"
  369. StrokeThickness="1.5" />
  370. <Rectangle
  371. Canvas.Top="8.25"
  372. Width="14"
  373. Height="1.5"
  374. Stroke="{Binding ElementName=TextAlignBtn, Path=Foreground}"
  375. StrokeThickness="1.5" />
  376. <Rectangle
  377. Canvas.Top="4.25"
  378. Width="14"
  379. Height="1.5"
  380. Stroke="{Binding ElementName=TextAlignBtn, Path=Foreground}"
  381. StrokeThickness="1.5" />
  382. <Rectangle
  383. Canvas.Top="12.25"
  384. Width="14"
  385. Height="1.5"
  386. Stroke="{Binding ElementName=TextAlignBtn, Path=Foreground}"
  387. StrokeThickness="1.5" />
  388. </Canvas>
  389. </Grid>
  390. </RadioButton.Content>
  391. <i:Interaction.Triggers>
  392. <i:EventTrigger EventName="Checked">
  393. <i:InvokeCommandAction Command="{Binding TextAlignCheckedCommand}" CommandParameter="{Binding ElementName=TextAlignBtn, Path=Tag}" />
  394. </i:EventTrigger>
  395. </i:Interaction.Triggers>
  396. </RadioButton>
  397. </StackPanel>
  398. <cusColor:ColorContent
  399. x:Name="FontColorBox"
  400. Width="56"
  401. HorizontalAlignment="Right"
  402. ShowColorList="Collapsed"
  403. UIColor="{Binding CurrentFontColor, Mode=OneWay}">
  404. <i:Interaction.Triggers>
  405. <i:EventTrigger EventName="SelectedColorInvoke">
  406. <i:InvokeCommandAction Command="{Binding SelectedColorCommand}" CommandParameter="{Binding ElementName=FontColorBox, Path=SelectedColor}" />
  407. </i:EventTrigger>
  408. </i:Interaction.Triggers>
  409. </cusColor:ColorContent>
  410. </Grid>
  411. </StackPanel>
  412. </StackPanel>
  413. <TextBlock
  414. x:Name="AlignImg"
  415. Margin="0,18,0,10"
  416. FontFamily="Segoe UI"
  417. FontSize="12"
  418. FontWeight="SemiBold"
  419. Foreground="{StaticResource color.sys.text.neutral.lv2}"
  420. LineHeight="20"
  421. Visibility="Collapsed">
  422. Align
  423. </TextBlock>
  424. </StackPanel>
  425. </Grid>
  426. <FormControl:LayoutAglinContent
  427. x:Name="laoutAglin"
  428. Grid.Row="1"
  429. IsLayoutAlign="{Binding IsLayoutAlign}"
  430. IsLayoutAvgAlign="{Binding IsLayoutAvgAlign}"
  431. Visibility="Collapsed">
  432. <i:Interaction.Triggers>
  433. <i:EventTrigger EventName="ValueChanged">
  434. <i:InvokeCommandAction Command="{Binding LayoutAlignCheckedCommand}" CommandParameter="{Binding ElementName=laoutAglin, Path=Btntag}" />
  435. </i:EventTrigger>
  436. </i:Interaction.Triggers>
  437. </FormControl:LayoutAglinContent>
  438. </Grid>
  439. </UserControl>