TextBox.xaml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <ResourceDictionary
  2. xmlns:ctrl="http://OpenSEMI.Ctrlib.com/presentation"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  5. <!-- TextBox Style -->
  6. <SolidColorBrush x:Key="TextBox_BD" Color="#FF1B1B1B"/>
  7. <SolidColorBrush x:Key="TextBox_BG" Color="White"/>
  8. <SolidColorBrush x:Key="TextBox_InnerBD" Color="#FFD6D6D6"/>
  9. <SolidColorBrush x:Key="TextBox_InnerLeft" Color="#FF898989"/>
  10. <SolidColorBrush x:Key="TextBox_InnerTop" Color="#FF565656"/>
  11. <SolidColorBrush x:Key="TextBox_InnerRight" Color="#FFD8D8D8"/>
  12. <SolidColorBrush x:Key="TextBox_InnerBottom" Color="#FFE0E0E0"/>
  13. <SolidColorBrush x:Key="TextBox_InnerBD_Unable" Color="#FFBEBDBD"/>
  14. <SolidColorBrush x:Key="TextBox_InnerLeft_Unable" Color="#FFABABAB"/>
  15. <SolidColorBrush x:Key="TextBox_InnerTop_Unable" Color="#FFB4B4B4"/>
  16. <SolidColorBrush x:Key="TextBox_InnerRight_Unable" Color="#FFE7E7E7"/>
  17. <SolidColorBrush x:Key="TextBox_InnerBottom_Unable" Color="#FFE7E7E7"/>
  18. <Style TargetType="ctrl:TextBoxEx">
  19. <Setter Property="Background" Value="White" />
  20. <Setter Property="ChangedColor" Value="White" />
  21. <Setter Property="NormalColor" Value="White" />
  22. <Setter Property="WarningColor" Value="White" />
  23. </Style>
  24. <Style TargetType="{x:Type TextBox}">
  25. <Setter Property="SnapsToDevicePixels" Value="True"/>
  26. <Setter Property="FontFamily" Value="Arial" />
  27. <Setter Property="FontSize" Value="12" />
  28. <Setter Property="BorderThickness" Value="1,1,0,0"/>
  29. <Setter Property="MinHeight" Value="20" />
  30. <Setter Property="Background" Value="{DynamicResource TextBox_BG}" />
  31. <Setter Property="Foreground" Value="Black" />
  32. <Setter Property="BorderBrush" Value="{DynamicResource TextBox_BD}"/>
  33. <Setter Property="Padding" Value="5,1"/>
  34. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  35. <Setter Property="VerticalContentAlignment" Value="Center"/>
  36. <Setter Property="AllowDrop" Value="true"/>
  37. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  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. <Grid>
  44. <Border x:Name="TextBox_Outer" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  45. BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  46. <Border x:Name="TextBox_Inner" BorderBrush="{DynamicResource TextBox_InnerBD}" BorderThickness="0,0,1,1" Padding="{TemplateBinding Padding}"/>
  47. </Border>
  48. <Rectangle x:Name="Lfet_Boder" Fill="{DynamicResource TextBox_InnerLeft}" HorizontalAlignment="Left" Width="1" Margin="1"/>
  49. <Rectangle x:Name="Top_Boder" Fill="{DynamicResource TextBox_InnerTop}" VerticalAlignment="Top" Height="1" Margin="1"/>
  50. <Rectangle x:Name="Right_Boder" Fill="{DynamicResource TextBox_InnerRight}" HorizontalAlignment="Right" Width="1" Margin="1,2,1,1"/>
  51. <Rectangle x:Name="Bottom_Boder" Fill="{DynamicResource TextBox_InnerBottom}" VerticalAlignment="Bottom" Height="1" Margin="1,1,2,1"/>
  52. <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
  53. </Grid>
  54. <ControlTemplate.Triggers>
  55. <Trigger Property="IsEnabled" Value="false">
  56. <Setter Property="BorderBrush" TargetName="TextBox_Outer" Value="{DynamicResource TextBox_BD_Unable}"/>
  57. <Setter Property="Background" TargetName="TextBox_Outer" Value="{DynamicResource TextBox_BG_Unable}"/>
  58. <Setter Property="BorderBrush" TargetName="TextBox_Inner" Value="{DynamicResource TextBox_InnerBD_Unable}"/>
  59. <Setter Property="Fill" TargetName="Lfet_Boder" Value="{DynamicResource TextBox_InnerLeft_Unable}"/>
  60. <Setter Property="Fill" TargetName="Top_Boder" Value="{DynamicResource TextBox_InnerTop_Unable}"/>
  61. <Setter Property="Fill" TargetName="Right_Boder" Value="{DynamicResource TextBox_InnerRight_Unable}"/>
  62. <Setter Property="Fill" TargetName="Bottom_Boder" Value="{DynamicResource TextBox_InnerBottom_Unable}"/>
  63. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  64. </Trigger>
  65. </ControlTemplate.Triggers>
  66. </ControlTemplate>
  67. </Setter.Value>
  68. </Setter>
  69. </Style>
  70. <Style TargetType="{x:Type PasswordBox}">
  71. <Setter Property="Background" Value="{DynamicResource TextBox_BG}" />
  72. <Setter Property="Foreground" Value="Black" />
  73. <Setter Property="BorderBrush" Value="{DynamicResource TextBox_BD}"/>
  74. <Setter Property="FontFamily" Value="Times New Roman"/>
  75. <Setter Property="PasswordChar" Value="●"/>
  76. <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
  77. <Setter Property="BorderThickness" Value="1"/>
  78. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  79. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  80. <Setter Property="AllowDrop" Value="true"/>
  81. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
  82. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  83. <Setter Property="Template">
  84. <Setter.Value>
  85. <ControlTemplate TargetType="{x:Type PasswordBox}">
  86. <Grid>
  87. <Border x:Name="TextBox_Outer" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  88. BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  89. <Border x:Name="TextBox_Inner" BorderBrush="{DynamicResource TextBox_InnerBD}" BorderThickness="0,0,1,1" Padding="{TemplateBinding Padding}"/>
  90. </Border>
  91. <Rectangle x:Name="Lfet_Boder" Fill="{DynamicResource TextBox_InnerLeft}" HorizontalAlignment="Left" Width="1" Margin="1"/>
  92. <Rectangle x:Name="Top_Boder" Fill="{DynamicResource TextBox_InnerTop}" VerticalAlignment="Top" Height="1" Margin="1"/>
  93. <Rectangle x:Name="Right_Boder" Fill="{DynamicResource TextBox_InnerRight}" HorizontalAlignment="Right" Width="1" Margin="1,2,1,1"/>
  94. <Rectangle x:Name="Bottom_Boder" Fill="{DynamicResource TextBox_InnerBottom}" VerticalAlignment="Bottom" Height="1" Margin="1,1,2,1"/>
  95. <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
  96. </Grid>
  97. <ControlTemplate.Triggers>
  98. <Trigger Property="IsEnabled" Value="false">
  99. <Setter Property="BorderBrush" TargetName="TextBox_Outer" Value="{DynamicResource TextBox_BD_Unable}"/>
  100. <Setter Property="Background" TargetName="TextBox_Outer" Value="{DynamicResource TextBox_BG_Unable}"/>
  101. <Setter Property="BorderBrush" TargetName="TextBox_Inner" Value="{DynamicResource TextBox_InnerBD_Unable}"/>
  102. <Setter Property="Fill" TargetName="Lfet_Boder" Value="{DynamicResource TextBox_InnerLeft_Unable}"/>
  103. <Setter Property="Fill" TargetName="Top_Boder" Value="{DynamicResource TextBox_InnerTop_Unable}"/>
  104. <Setter Property="Fill" TargetName="Right_Boder" Value="{DynamicResource TextBox_InnerRight_Unable}"/>
  105. <Setter Property="Fill" TargetName="Bottom_Boder" Value="{DynamicResource TextBox_InnerBottom_Unable}"/>
  106. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  107. </Trigger>
  108. </ControlTemplate.Triggers>
  109. </ControlTemplate>
  110. </Setter.Value>
  111. </Setter>
  112. </Style>
  113. <ControlTemplate x:Key="ValidationTemplate">
  114. <DockPanel>
  115. <Border BorderBrush="Red" BorderThickness="1">
  116. <AdornedElementPlaceholder/>
  117. </Border>
  118. <TextBlock Foreground="Red" FontSize="20">*</TextBlock>
  119. </DockPanel>
  120. </ControlTemplate>
  121. <!-- TextBox_Top Style -->
  122. <SolidColorBrush x:Key="TextBox_Top_BG" Color="White"/>
  123. <SolidColorBrush x:Key="TextBox_Top_Shadow" Color="#FF1B1B1B"/>
  124. <SolidColorBrush x:Key="TextBox_Top_Highlight_Right" Color="#FFB4B4B4"/>
  125. <SolidColorBrush x:Key="TextBox_Top_Highlight_Bottom" Color="#FFD2D2D2"/>
  126. <Style x:Key="TextBox_Top" TargetType="{x:Type TextBox}">
  127. <Setter Property="SnapsToDevicePixels" Value="True"/>
  128. <Setter Property="FontFamily" Value="Arial" />
  129. <Setter Property="FontSize" Value="14" />
  130. <Setter Property="BorderThickness" Value="2,2,0,0"/>
  131. <Setter Property="MinHeight" Value="20" />
  132. <Setter Property="Background" Value="{DynamicResource TextBox_Top_BG}" />
  133. <Setter Property="Foreground" Value="{DynamicResource Foreground_Black}" />
  134. <Setter Property="BorderBrush" Value="{DynamicResource TextBox_Top_Shadow}"/>
  135. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  136. <Setter Property="VerticalContentAlignment" Value="Center"/>
  137. <Setter Property="AllowDrop" Value="true"/>
  138. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  139. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
  140. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  141. <Setter Property="Template">
  142. <Setter.Value>
  143. <ControlTemplate TargetType="{x:Type TextBox}">
  144. <Grid>
  145. <Border x:Name="TextBox_Bg" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  146. BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  147. <Grid>
  148. <Rectangle Fill="{DynamicResource TextBox_Top_Highlight_Right}" HorizontalAlignment="Right" Width="2"/>
  149. <Rectangle Fill="{DynamicResource TextBox_Top_Highlight_Bottom}" VerticalAlignment="Bottom" Height="2"/>
  150. <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="5,1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
  151. </Grid>
  152. </Border>
  153. </Grid>
  154. <ControlTemplate.Triggers>
  155. <Trigger Property="IsEnabled" Value="false">
  156. <Setter Property="Background" TargetName="TextBox_Bg" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
  157. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  158. </Trigger>
  159. </ControlTemplate.Triggers>
  160. </ControlTemplate>
  161. </Setter.Value>
  162. </Setter>
  163. </Style>
  164. <!-- Login TextBox -->
  165. <SolidColorBrush x:Key="TextBox_Login_BG" Color="#FF006CB8"/>
  166. <SolidColorBrush x:Key="TextBox_Login_BD" Color="#FF0A2B58"/>
  167. <SolidColorBrush x:Key="TextBox_BG_Unable" Color="Gainsboro"/>
  168. <SolidColorBrush x:Key="TextBox_BD_Unable" Color="#FF747474"/>
  169. <Style x:Key="Login_TextBox" TargetType="{x:Type TextBox}">
  170. <Setter Property="SnapsToDevicePixels" Value="True"/>
  171. <Setter Property="FontFamily" Value="Arial" />
  172. <Setter Property="FontSize" Value="14" />
  173. <Setter Property="BorderThickness" Value="2"/>
  174. <Setter Property="MinHeight" Value="20" />
  175. <Setter Property="Background" Value="{StaticResource TextBox_Login_BG}"/>
  176. <Setter Property="Foreground" Value="{DynamicResource FG_White}" />
  177. <Setter Property="BorderBrush" Value="{StaticResource TextBox_Login_BD}"/>
  178. <Setter Property="Padding" Value="5,1"/>
  179. <Setter Property="Border.CornerRadius" Value="5"/>
  180. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  181. <Setter Property="VerticalContentAlignment" Value="Center"/>
  182. <Setter Property="AllowDrop" Value="true"/>
  183. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  184. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
  185. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  186. <Setter Property="Template">
  187. <Setter.Value>
  188. <ControlTemplate TargetType="{x:Type TextBox}">
  189. <Border x:Name="BG" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{TemplateBinding Border.CornerRadius}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  190. <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
  191. </Border>
  192. <ControlTemplate.Triggers>
  193. <Trigger Property="IsEnabled" Value="false">
  194. <Setter Property="BorderBrush" TargetName="BG" Value="{StaticResource TextBox_BD_Unable}"/>
  195. <Setter Property="Background" TargetName="BG" Value="{StaticResource TextBox_BG_Unable}"/>
  196. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  197. </Trigger>
  198. </ControlTemplate.Triggers>
  199. </ControlTemplate>
  200. </Setter.Value>
  201. </Setter>
  202. </Style>
  203. <Style x:Key="Login_PasswordBox" TargetType="{x:Type PasswordBox}">
  204. <Setter Property="Background" Value="{StaticResource TextBox_Login_BG}"/>
  205. <Setter Property="Foreground" Value="{DynamicResource FG_White}" />
  206. <Setter Property="BorderBrush" Value="{StaticResource TextBox_Login_BD}"/>
  207. <Setter Property="SnapsToDevicePixels" Value="True"/>
  208. <Setter Property="FontFamily" Value="Arial" />
  209. <Setter Property="PasswordChar" Value="●"/>
  210. <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
  211. <Setter Property="BorderThickness" Value="2"/>
  212. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  213. <Setter Property="VerticalContentAlignment" Value="Center"/>
  214. <Setter Property="Padding" Value="5,1"/>
  215. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  216. <Setter Property="AllowDrop" Value="true"/>
  217. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
  218. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  219. <Setter Property="Template">
  220. <Setter.Value>
  221. <ControlTemplate TargetType="{x:Type PasswordBox}">
  222. <Border x:Name="BG" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="5" Background="{TemplateBinding Background}">
  223. <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
  224. </Border>
  225. <ControlTemplate.Triggers>
  226. <Trigger Property="IsEnabled" Value="false">
  227. <Setter Property="BorderBrush" TargetName="BG" Value="{StaticResource TextBox_BD_Unable}"/>
  228. <Setter Property="Background" TargetName="BG" Value="{StaticResource TextBox_BG_Unable}"/>
  229. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  230. </Trigger>
  231. </ControlTemplate.Triggers>
  232. </ControlTemplate>
  233. </Setter.Value>
  234. </Setter>
  235. </Style>
  236. </ResourceDictionary>