TextEditProperty.xaml 27 KB

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