TextBoxStyle.xaml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:cus="clr-namespace:PDF_Master.CustomControl">
  5. <Style x:Key="PagesView_txtContext" TargetType="{x:Type TextBlock}">
  6. <Setter Property="FontFamily" Value="Segoe UI" />
  7. <Setter Property="FontSize" Value="12" />
  8. </Style>
  9. <Style x:Key="ViewMode_txtContext" TargetType="{x:Type TextBlock}">
  10. <Setter Property="FontFamily" Value="Segoe UI" />
  11. <Setter Property="FontSize" Value="11" />
  12. </Style>
  13. <Style x:Key="PagesView_titleContext" TargetType="{x:Type TextBlock}">
  14. <Setter Property="FontFamily" Value=" Segoe UI Semibold" />
  15. <Setter Property="FontWeight" Value="SemiBold" />
  16. <Setter Property="FontSize" Value="14" />
  17. </Style>
  18. <!-- style for property seconed title -->
  19. <Style x:Key="PropertyHeaderLv2" TargetType="{x:Type TextBlock}">
  20. <Setter Property="FontFamily" Value="Segoe UI" />
  21. <Setter Property="FontSize" Value="12" />
  22. <Setter Property="LineHeight" Value="20" />
  23. <Setter Property="FontWeight" Value="SemiBold" />
  24. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv2}" />
  25. </Style>
  26. <SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3" />
  27. <SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA" />
  28. <SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF569DE5" />
  29. <Style x:Key="TextBoxStyleRadius" TargetType="{x:Type TextBox}">
  30. <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
  31. <Setter Property="BorderBrush" Value="{StaticResource TextBox.Static.Border}" />
  32. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
  33. <Setter Property="BorderThickness" Value="1" />
  34. <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
  35. <Setter Property="HorizontalContentAlignment" Value="Left" />
  36. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  37. <Setter Property="AllowDrop" Value="true" />
  38. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
  39. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  40. <Setter Property="Template">
  41. <Setter.Value>
  42. <ControlTemplate TargetType="{x:Type TextBox}">
  43. <Border
  44. x:Name="border"
  45. Background="{TemplateBinding Background}"
  46. BorderBrush="{TemplateBinding BorderBrush}"
  47. BorderThickness="{TemplateBinding BorderThickness}"
  48. CornerRadius="4"
  49. SnapsToDevicePixels="True">
  50. <ScrollViewer
  51. x:Name="PART_ContentHost"
  52. Focusable="false"
  53. HorizontalScrollBarVisibility="Hidden"
  54. VerticalScrollBarVisibility="Hidden" />
  55. </Border>
  56. <ControlTemplate.Triggers>
  57. <Trigger Property="IsEnabled" Value="false">
  58. <Setter TargetName="border" Property="Opacity" Value="0.56" />
  59. </Trigger>
  60. <Trigger Property="IsMouseOver" Value="true">
  61. <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource TextBox.MouseOver.Border}" />
  62. </Trigger>
  63. <Trigger Property="IsKeyboardFocused" Value="true">
  64. <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource TextBox.Focus.Border}" />
  65. </Trigger>
  66. </ControlTemplate.Triggers>
  67. </ControlTemplate>
  68. </Setter.Value>
  69. </Setter>
  70. <Style.Triggers>
  71. <MultiTrigger>
  72. <MultiTrigger.Conditions>
  73. <Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
  74. <Condition Property="IsSelectionActive" Value="false" />
  75. </MultiTrigger.Conditions>
  76. <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
  77. </MultiTrigger>
  78. </Style.Triggers>
  79. </Style>
  80. <!-- 没有颜色变化的文本框 -->
  81. <Style x:Key="InnerTextBox" TargetType="{x:Type cus:TextBoxEx}">
  82. <Setter Property="Background" Value="{StaticResource color.field.bg.def}" />
  83. <Setter Property="BorderBrush" Value="{StaticResource color.field.border.norm}" />
  84. <Setter Property="Foreground" Value="Black" />
  85. <Setter Property="VerticalContentAlignment" Value="Center" />
  86. <Setter Property="HorizontalContentAlignment" Value="Left" />
  87. <Setter Property="BorderThickness" Value="0" />
  88. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  89. <Setter Property="Height" Value="32" />
  90. <Setter Property="Padding" Value="3,0" />
  91. <Setter Property="CornerRadius" Value="4" />
  92. <Setter Property="Template">
  93. <Setter.Value>
  94. <ControlTemplate TargetType="{x:Type cus:TextBoxEx}">
  95. <Border
  96. x:Name="border"
  97. Width="{TemplateBinding Width}"
  98. Height="{TemplateBinding Height}"
  99. Background="{TemplateBinding Background}"
  100. BorderBrush="{TemplateBinding BorderBrush}"
  101. BorderThickness="{TemplateBinding BorderThickness}"
  102. CornerRadius="{TemplateBinding CornerRadius}"
  103. SnapsToDevicePixels="True">
  104. <Grid Margin="{TemplateBinding Padding}">
  105. <TextBlock
  106. x:Name="placeholder"
  107. Padding="{TemplateBinding Padding}"
  108. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  109. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  110. FontSize="{TemplateBinding FontSize}"
  111. Foreground="{TemplateBinding PlaceholderForeground}"
  112. Text="{TemplateBinding PlaceholderText}"
  113. Visibility="Collapsed" />
  114. <Grid VerticalAlignment="Center">
  115. <Grid.ColumnDefinitions>
  116. <ColumnDefinition Width="*" />
  117. <ColumnDefinition Width="auto" />
  118. </Grid.ColumnDefinitions>
  119. <ScrollViewer
  120. x:Name="PART_ContentHost"
  121. Margin="0"
  122. HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
  123. VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
  124. Focusable="false"
  125. Foreground="{TemplateBinding Foreground}"
  126. HorizontalScrollBarVisibility="Hidden"
  127. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  128. Style="{x:Null}"
  129. VerticalScrollBarVisibility="Hidden" />
  130. <Button
  131. Name="PART_BtnClear"
  132. Grid.Column="1"
  133. Width="16"
  134. Height="16"
  135. Margin="9,0"
  136. HorizontalAlignment="Right"
  137. VerticalAlignment="Center"
  138. Background="Transparent"
  139. BorderThickness="0"
  140. Style="{StaticResource NoColorBtn}"
  141. Visibility="Collapsed">
  142. <Path
  143. Data="M8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15ZM11.5303 5.53038L9.06069 8L11.5303 10.4696L10.4697 11.5303L8.00002 9.06066L5.53033 11.5303L4.46967 10.4697L6.93936 8L4.46967 5.53033L5.53033 4.46967L8.00002 6.93934L10.4697 4.46971L11.5303 5.53038Z"
  144. Fill="#CED0D4"
  145. Stretch="Uniform" />
  146. </Button>
  147. </Grid>
  148. </Grid>
  149. </Border>
  150. <ControlTemplate.Triggers>
  151. <Trigger Property="IsEnabled" Value="false">
  152. <Setter TargetName="border" Property="Opacity" Value="0.56" />
  153. </Trigger>
  154. <Trigger Property="Text" Value="{x:Null}">
  155. <Setter TargetName="placeholder" Property="Visibility" Value="Visible" />
  156. </Trigger>
  157. <Trigger Property="IsMouseOver" Value="True">
  158. <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Visible" />
  159. </Trigger>
  160. <Trigger Property="IsFocused" Value="True">
  161. <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Visible" />
  162. </Trigger>
  163. <MultiTrigger>
  164. <MultiTrigger.Conditions>
  165. <Condition Property="IsFocused" Value="True" />
  166. <Condition Property="IsError" Value="True" />
  167. </MultiTrigger.Conditions>
  168. <MultiTrigger.Setters>
  169. <Setter TargetName="border" Property="Effect" Value="{StaticResource shadow.error.s}" />
  170. </MultiTrigger.Setters>
  171. </MultiTrigger>
  172. <Trigger Property="IsError" Value="True">
  173. <Setter Property="BorderBrush" Value="{StaticResource color.sys.border.error}" />
  174. </Trigger>
  175. <Trigger Property="Text" Value="">
  176. <Setter TargetName="placeholder" Property="Visibility" Value="Visible" />
  177. <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Collapsed" />
  178. </Trigger>
  179. <Trigger Property="ShowClose" Value="False">
  180. <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Collapsed" />
  181. </Trigger>
  182. <MultiTrigger>
  183. <MultiTrigger.Conditions>
  184. <Condition Property="Text" Value="" />
  185. <Condition Property="IsMouseOver" Value="True" />
  186. </MultiTrigger.Conditions>
  187. <MultiTrigger.Setters>
  188. <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Collapsed" />
  189. </MultiTrigger.Setters>
  190. </MultiTrigger>
  191. </ControlTemplate.Triggers>
  192. </ControlTemplate>
  193. </Setter.Value>
  194. </Setter>
  195. <Style.Triggers>
  196. <MultiTrigger>
  197. <MultiTrigger.Conditions>
  198. <Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
  199. <Condition Property="IsSelectionActive" Value="false" />
  200. </MultiTrigger.Conditions>
  201. <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
  202. </MultiTrigger>
  203. </Style.Triggers>
  204. </Style>
  205. <Style x:Key="Print_normalTxtStyle" TargetType="TextBox">
  206. <Setter Property="Template">
  207. <Setter.Value>
  208. <ControlTemplate>
  209. <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
  210. <Border
  211. Background="{StaticResource color.field.bg.def}"
  212. BorderBrush="{StaticResource color.field.border.norm}"
  213. BorderThickness="1"
  214. CornerRadius="4">
  215. <ScrollViewer
  216. x:Name="PART_ContentHost"
  217. MinHeight="22"
  218. Margin="8,0,0,0"
  219. VerticalAlignment="Center"
  220. Focusable="false"
  221. HorizontalScrollBarVisibility="Hidden"
  222. Opacity="1"
  223. VerticalScrollBarVisibility="Hidden" />
  224. </Border>
  225. </Grid>
  226. <ControlTemplate.Triggers>
  227. <Trigger Property="IsEnabled" Value="False">
  228. <Setter Property="Opacity" Value="0.6" />
  229. </Trigger>
  230. </ControlTemplate.Triggers>
  231. </ControlTemplate>
  232. </Setter.Value>
  233. </Setter>
  234. </Style>
  235. </ResourceDictionary>