TextEditProperty.xaml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <UserControl x:Class="PDF_Office.Views.PropertyPanel.TextEditProperty"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel"
  7. xmlns:prism="http://prismlibrary.com/"
  8. prism:ViewModelLocator.AutoWireViewModel="True"
  9. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  10. xmlns:Convert="clr-namespace:PDF_Office.DataConvert"
  11. xmlns:cus="clr-namespace:PDF_Office.CustomControl"
  12. xmlns:CompositeControl="clr-namespace:PDF_Office.CustomControl.CompositeControl"
  13. mc:Ignorable="d"
  14. d:DesignHeight="450" d:DesignWidth="800">
  15. <UserControl.Resources>
  16. <ResourceDictionary>
  17. <ResourceDictionary.MergedDictionaries>
  18. <ResourceDictionary Source="../../Styles/SliderStyle.xaml"></ResourceDictionary>
  19. <ResourceDictionary Source="../../Styles/CustomBtnStyle.xaml"/>
  20. <ResourceDictionary Source="../../Styles/RadioButtonStyle.xaml"/>
  21. </ResourceDictionary.MergedDictionaries>
  22. <Convert:CheckToVisibleMutiConvert x:Key="CheckToVisibleMutiConvert"/>
  23. <Style x:Key="line1Style" TargetType="{x:Type Line}">
  24. <Setter Property="Visibility">
  25. <Setter.Value>
  26. <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
  27. <Binding ElementName="TextAlignLeftBtn" Path="IsChecked"/>
  28. <Binding ElementName="TextAlignCenterBtn" Path="IsChecked"/>
  29. </MultiBinding>
  30. </Setter.Value>
  31. </Setter>
  32. </Style>
  33. <Style x:Key="line2Style" TargetType="{x:Type Line}">
  34. <Setter Property="Visibility">
  35. <Setter.Value>
  36. <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
  37. <Binding ElementName="TextAlignCenterBtn" Path="IsChecked"/>
  38. <Binding ElementName="TextAlignRightBtn" Path="IsChecked"/>
  39. </MultiBinding>
  40. </Setter.Value>
  41. </Setter>
  42. </Style>
  43. <ContextMenu x:Key="BtnFlyoutMenu" FontSize="14"
  44. >
  45. <ContextMenu.ItemContainerStyle>
  46. <Style TargetType="MenuItem">
  47. <Setter Property="Padding" Value="0,7,0,7"/>
  48. <Setter Property="VerticalContentAlignment" Value="Center"/>
  49. </Style>
  50. </ContextMenu.ItemContainerStyle>
  51. <MenuItem Name="ChangeStyleMenuItem" Header="用所选部分重新定义" IsEnabled="True">
  52. </MenuItem>
  53. <MenuItem Name="BackStyleMenuItem" Header="恢复默认预设样式" IsEnabled="True">
  54. </MenuItem>
  55. </ContextMenu>
  56. <DataTemplate x:Key="FontStyleData">
  57. <Grid >
  58. <TextBlock Text="{Binding mFontStyleName}" Foreground="Black"/>
  59. </Grid>
  60. </DataTemplate>
  61. </ResourceDictionary>
  62. </UserControl.Resources>
  63. <Grid Background="#F3F3F3">
  64. <StackPanel>
  65. <TextBlock Name="AnnotTypeTitle" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="18" LineHeight="24" HorizontalAlignment="Left" Margin="10,8,0,0">Freetext</TextBlock>
  66. <Border Width="228" Height="100" BorderThickness="1" CornerRadius="2" BorderBrush="#DDDDDD" Background="White" Margin="0,8,0,0">
  67. <Grid>
  68. <Border Name="FreeTextBorder" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="5"
  69. Opacity="{Binding FillOpacity}"
  70. Background="{Binding FillColor}">
  71. <TextBlock Name="SampleText"
  72. Foreground="{Binding SelectColor}"
  73. FontFamily="{Binding TextFontFamily}"
  74. FontWeight="{Binding TextFontWeights}"
  75. FontStyle="{Binding TextFontStyle}"
  76. FontSize="{Binding TextFontSize}" Opacity="{Binding FillOpacity}"
  77. Text="Sample" HorizontalAlignment="Center" VerticalAlignment="Center">
  78. </TextBlock>
  79. </Border>
  80. <Path Name="UnderlinePath" HorizontalAlignment="Center" StrokeThickness="2" Margin="0,51,0,0" Visibility="Collapsed">
  81. <Path.Data>
  82. <LineGeometry StartPoint="0,0" EndPoint="62,0"></LineGeometry>
  83. </Path.Data>
  84. </Path>
  85. <Path Name="StrikeoutPath" HorizontalAlignment="Center" StrokeThickness="2" Margin="0,40,0,0" Visibility="Collapsed">
  86. <Path.Data>
  87. <LineGeometry StartPoint="0,0" EndPoint="62,0"></LineGeometry>
  88. </Path.Data>
  89. </Path>
  90. <Path Name="SquigglyPath" HorizontalAlignment="Center" StrokeThickness="2" Margin="0,51,0,0" Visibility="Collapsed">
  91. </Path>
  92. </Grid>
  93. </Border>
  94. <Border BorderBrush="#E2E3E6" Height="32" Margin="12,0,4,0" BorderThickness="0">
  95. <StackPanel Orientation="Horizontal">
  96. <ComboBox IsReadOnly="True" Name="FontTitleBox" Background="Transparent" Padding="10 10 0 0" Width="148" BorderThickness="1" BorderBrush="#FFE2E3E6"
  97. ItemsSource="{Binding FontStyleList}"
  98. ItemTemplate="{StaticResource FontStyleData}"
  99. >
  100. <i:Interaction.Triggers>
  101. <i:EventTrigger EventName="SelectionChanged">
  102. <i:InvokeCommandAction Command="{Binding SelectedFontStyleCommand}" CommandParameter="{Binding ElementName=FontTitleBox,Path=SelectedItem}"/>
  103. </i:EventTrigger>
  104. </i:Interaction.Triggers>
  105. </ComboBox>
  106. <Button Width="32" Height="32" ContextMenu="{StaticResource BtnFlyoutMenu}"/>
  107. </StackPanel>
  108. </Border>
  109. <TextBlock x:Name="FontText" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,18,0,0" >Font</TextBlock>
  110. <Grid Margin="0,6,0,0">
  111. <Grid.ColumnDefinitions>
  112. <ColumnDefinition Width="auto"></ColumnDefinition>
  113. <ColumnDefinition Width="auto"></ColumnDefinition>
  114. </Grid.ColumnDefinitions>
  115. <Grid.RowDefinitions>
  116. <RowDefinition Height="auto"></RowDefinition>
  117. <RowDefinition Height="auto"></RowDefinition>
  118. <RowDefinition Height="auto"></RowDefinition>
  119. </Grid.RowDefinitions>
  120. <Border BorderBrush="#E2E3E6" Grid.ColumnSpan="2" Width="228" Height="32" Margin="12,0,4,0" BorderThickness="0">
  121. <Grid>
  122. <ComboBox IsReadOnly="True" Name="FontFamilyBox" Background="Transparent" Padding="10 10 0 0" BorderThickness="1" BorderBrush="#FFE2E3E6"
  123. >
  124. <ComboBox.ItemContainerStyle>
  125. <Style TargetType="{x:Type ComboBoxItem}">
  126. <Setter Property="Padding" Value="10 0 0 0"/>
  127. </Style>
  128. </ComboBox.ItemContainerStyle>
  129. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
  130. <TextBlock Text="Courier New" FontFamily="Courier New" Tag="Courier" FontSize="14"/>
  131. </ComboBoxItem>
  132. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
  133. <TextBlock Text="Arial" FontFamily="Arial" Tag="Helvetica" FontSize="14"/>
  134. </ComboBoxItem>
  135. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
  136. <TextBlock Text="Times New Roman" FontFamily="Times New Roman" Tag="Times Roman" FontSize="14"/>
  137. </ComboBoxItem>
  138. <i:Interaction.Triggers>
  139. <i:EventTrigger EventName="SelectionChanged">
  140. <i:InvokeCommandAction Command="{Binding FontFamilyChangedCommand}" CommandParameter="{Binding ElementName=FontFamilyBox,Path=SelectedIndex}"/>
  141. </i:EventTrigger>
  142. </i:Interaction.Triggers>
  143. </ComboBox>
  144. <TextBox Name="FontFamilyText" FontFamily="Segoe UI" FontSize="14" Background="White" Padding="10 0 0 0" Margin="2,0,25,0" IsReadOnly="True"
  145. BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left">
  146. </TextBox>
  147. </Grid>
  148. </Border>
  149. <cus:ColorDropBox x:Name="FontColorBox" Grid.Column="1" Grid.Row="2" SelectedColorChanged="FontColorBox_SelectedColorChanged" BorderThickness="1" BorderBrush="#E2E3E6" Width="80" Height="32" HorizontalAlignment="Left"
  150. ></cus:ColorDropBox>
  151. <Border Grid.Row="1" BorderBrush="#E2E3E6" Width="148" Height="32" Margin="12,8,4,0" BorderThickness="0">
  152. <Grid>
  153. <ComboBox Name="FontStyleBox" IsReadOnly="True" BorderThickness="1" BorderBrush="#FFE2E3E6" Padding="10 10 0 0" Background="Transparent">
  154. <ComboBox.ItemContainerStyle>
  155. <Style TargetType="{x:Type ComboBoxItem}">
  156. <Setter Property="Padding" Value="10 0 0 0"/>
  157. </Style>
  158. </ComboBox.ItemContainerStyle>
  159. <ComboBoxItem x:Name="RegularItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Regular</ComboBoxItem>
  160. <ComboBoxItem x:Name="BoldItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Bold</ComboBoxItem>
  161. <ComboBoxItem x:Name="ItalicItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Italic</ComboBoxItem>
  162. <ComboBoxItem x:Name="BoldItalicItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Bold Italic</ComboBoxItem>
  163. <i:Interaction.Triggers>
  164. <i:EventTrigger EventName="SelectionChanged">
  165. <i:InvokeCommandAction Command="{Binding FontStyleChangedCommand}" CommandParameter="{Binding ElementName=FontStyleBox,Path=SelectedItem}"/>
  166. </i:EventTrigger>
  167. </i:Interaction.Triggers>
  168. </ComboBox>
  169. <TextBox Name="FontStyleText" IsReadOnly="True" FontFamily="Segoe UI" FontSize="14" Background="White" Padding="10 0 0 0" Height="20" Margin="2,0,35,0"
  170. BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left">
  171. </TextBox>
  172. </Grid>
  173. </Border>
  174. <Border Grid.Row="1" Grid.Column="1" BorderBrush="#E2E3E6" Width="80" Height="32" Margin="-1,8,0,0" BorderThickness="0">
  175. <Grid>
  176. <ComboBox Name="FontSizeBox" BorderThickness="1" Background="Transparent" BorderBrush="#FFE2E3E6"
  177. MaxDropDownHeight="200">
  178. <ComboBox.ItemContainerStyle>
  179. <Style TargetType="{x:Type ComboBoxItem}">
  180. <Setter Property="Padding" Value="10 0 0 0"/>
  181. </Style>
  182. </ComboBox.ItemContainerStyle>
  183. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">6</ComboBoxItem>
  184. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">8</ComboBoxItem>
  185. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">9</ComboBoxItem>
  186. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">10</ComboBoxItem>
  187. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">12</ComboBoxItem>
  188. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">14</ComboBoxItem>
  189. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">18</ComboBoxItem>
  190. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">20</ComboBoxItem>
  191. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">22</ComboBoxItem>
  192. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">24</ComboBoxItem>
  193. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">26</ComboBoxItem>
  194. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">28</ComboBoxItem>
  195. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">32</ComboBoxItem>
  196. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">36</ComboBoxItem>
  197. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">48</ComboBoxItem>
  198. <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">72</ComboBoxItem>
  199. <i:Interaction.Triggers>
  200. <i:EventTrigger EventName="SelectionChanged">
  201. <i:InvokeCommandAction Command="{Binding FontSizeChangedCommand}" CommandParameter="{Binding ElementName=FontSizeBox,Path=SelectedItem}"/>
  202. </i:EventTrigger>
  203. </i:Interaction.Triggers>
  204. </ComboBox>
  205. <TextBox Name="FontSizeText" FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Padding="10 0 0 0" Margin="2,0,35,0"
  206. BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left" IsReadOnly="True">
  207. </TextBox>
  208. </Grid>
  209. </Border>
  210. <Border Grid.ColumnSpan="2" Grid.Row="2" Width="148" Margin="12,8,0,0" HorizontalAlignment="Left">
  211. <Grid Name="ToolGrid">
  212. <Grid.ColumnDefinitions>
  213. <ColumnDefinition Width="*"></ColumnDefinition>
  214. <ColumnDefinition Width="*"></ColumnDefinition>
  215. <ColumnDefinition Width="*"></ColumnDefinition>
  216. <ColumnDefinition Width="*"></ColumnDefinition>
  217. </Grid.ColumnDefinitions>
  218. <RadioButton x:Name="TextAlignLeftBtn" Tag="AlignLeft" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
  219. Style="{DynamicResource GreyBgRadioBtnStyle}" >
  220. <RadioButton.Content>
  221. <Grid Width="32" Height="32">
  222. <Canvas Margin="5,10,0,0">
  223. <Rectangle Canvas.Top="0.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignLeftBtn,Path=Foreground}"/>
  224. <Rectangle Canvas.Top="4.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignLeftBtn,Path=Foreground}"/>
  225. <Rectangle Canvas.Top="12.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignLeftBtn,Path=Foreground}"/>
  226. <Rectangle Canvas.Top="8.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignLeftBtn,Path=Foreground}"/>
  227. </Canvas>
  228. </Grid>
  229. </RadioButton.Content>
  230. </RadioButton>
  231. <RadioButton x:Name="TextAlignCenterBtn" Grid.Column="1" Tag="AlignCenter" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
  232. Style="{DynamicResource GreyBgRadioBtnStyle}" >
  233. <RadioButton.Content>
  234. <Grid Width="32" Height="32">
  235. <Canvas Margin="5,10,0,0">
  236. <Rectangle Canvas.Top="0.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignCenterBtn,Path=Foreground}"/>
  237. <Rectangle Canvas.Left="3" Canvas.Top="4.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignCenterBtn,Path=Foreground}"/>
  238. <Rectangle Canvas.Left="3" Canvas.Top="12.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignCenterBtn,Path=Foreground}"/>
  239. <Rectangle Canvas.Top="8.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignCenterBtn,Path=Foreground}"/>
  240. </Canvas>
  241. </Grid>
  242. </RadioButton.Content>
  243. </RadioButton>
  244. <RadioButton x:Name="TextAlignRightBtn" Grid.Column="2" Tag="AlignRight" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
  245. Style="{DynamicResource GreyBgRadioBtnStyle}" >
  246. <RadioButton.Content>
  247. <Grid Width="32" Height="32">
  248. <Canvas Margin="5,10,0,0">
  249. <Rectangle Canvas.Top="0.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignRightBtn,Path=Foreground}"/>
  250. <Rectangle Canvas.Left="6" Canvas.Top="4.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignRightBtn,Path=Foreground}"/>
  251. <Rectangle Canvas.Left="6" Canvas.Top="12.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignRightBtn,Path=Foreground}"/>
  252. <Rectangle Canvas.Top="8.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignRightBtn,Path=Foreground}"/>
  253. </Canvas>
  254. </Grid>
  255. </RadioButton.Content>
  256. </RadioButton>
  257. <RadioButton x:Name="TextAlignBtn" Grid.Column="3" Tag="Align" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
  258. Style="{DynamicResource GreyBgRadioBtnStyle}" >
  259. <RadioButton.Content>
  260. <Grid Width="32" Height="32">
  261. <Canvas Margin="5,10,0,0">
  262. <Rectangle Canvas.Top="0.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignBtn,Path=Foreground}"/>
  263. <Rectangle Canvas.Top="8.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignBtn,Path=Foreground}"/>
  264. <Rectangle Canvas.Top="4.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignBtn,Path=Foreground}"/>
  265. <Rectangle Canvas.Top="12.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignBtn,Path=Foreground}"/>
  266. </Canvas>
  267. </Grid>
  268. </RadioButton.Content>
  269. </RadioButton>
  270. </Grid>
  271. </Border>
  272. </Grid>
  273. <!--<Grid Margin="0,18,0,0">
  274. <Grid.RowDefinitions>
  275. <RowDefinition Height="auto"/>
  276. <RowDefinition/>
  277. </Grid.RowDefinitions>
  278. <CompositeControl:SlidContent x:Name="layerThick" HorizontalAlignment="Right"/>
  279. <CompositeControl:ColorContent Grid.Row="1" x:Name="cusColor"/>
  280. </Grid>-->
  281. <TextBlock x:Name="AlignText" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,14,0,0" >Thickness</TextBlock>
  282. <Grid Width="150" HorizontalAlignment="Left" Margin="0,10,0,0">
  283. <Grid.RowDefinitions>
  284. <RowDefinition Height="*"/>
  285. <RowDefinition Height="*"/>
  286. </Grid.RowDefinitions>
  287. <Grid.ColumnDefinitions>
  288. <ColumnDefinition Width="*"/>
  289. <ColumnDefinition Width="*"/>
  290. <ColumnDefinition Width="*"/>
  291. <ColumnDefinition Width="*"/>
  292. </Grid.ColumnDefinitions>
  293. <Button Grid.Row="0" Grid.Column="0" Width="32" Height="32"/>
  294. <Button Grid.Row="0" Grid.Column="1" Width="32" Height="32"/>
  295. <Button Grid.Row="0" Grid.Column="2" Width="32" Height="32"/>
  296. <Button Grid.Row="0" Grid.Column="3" Width="32" Height="32"/>
  297. <Button Grid.Row="1" Grid.Column="0" Margin="0,10,0,0" Width="32" Height="32"/>
  298. <Button Grid.Row="1" Grid.Column="1" Margin="0,10,0,0" Width="32" Height="32"/>
  299. <Button Grid.Row="1" Grid.Column="2" Margin="0,10,0,0" Width="32" Height="32"/>
  300. <Button Grid.Row="1" Grid.Column="3" Margin="0,10,0,0" Width="32" Height="32"/>
  301. </Grid>
  302. </StackPanel>
  303. </Grid>
  304. </UserControl>