TextBoxStyle.xaml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:aero="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
  4. <!--通用文本样式-->
  5. <Style TargetType="TextBox">
  6. <Setter Property="Margin" Value="0,10" />
  7. <Setter Property="Height" Value="35" />
  8. <!--<Setter Property="Width" Value="190"></Setter>-->
  9. <Setter Property="FontSize" Value="18" />
  10. <Setter Property="Background" Value="#FFDCF7F6"></Setter>
  11. <Style.Triggers>
  12. <Trigger Property="IsMouseOver" Value="True">
  13. <Setter Property="Foreground" Value="Green" />
  14. <Setter Property="BorderBrush" Value="Green" />
  15. <Setter Property="BorderThickness" Value="2" />
  16. </Trigger>
  17. <Trigger Property="Validation.HasError" Value="true">
  18. <Setter Property="ToolTip"
  19. Value="{Binding RelativeSource={x:Static RelativeSource.Self},
  20. Path=(Validation.Errors)[0].ErrorContent}"/>
  21. </Trigger>
  22. </Style.Triggers>
  23. </Style>
  24. <Style TargetType="TextBox" x:Key="SmallTextBox" BasedOn="{StaticResource {x:Type TextBox}}">
  25. <Setter Property="Height" Value="25"/>
  26. <Setter Property="FontSize" Value="12" />
  27. </Style>
  28. <!--登录界面文本框样式-->
  29. <Style TargetType="TextBox" x:Key="LoginTextBox">
  30. <Setter Property="Template">
  31. <Setter.Value>
  32. <ControlTemplate TargetType="TextBoxBase">
  33. <aero:ListBoxChrome Background="{TemplateBinding Control.Background}" BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="{TemplateBinding Control.BorderThickness}" Name="Bd" RenderFocused="{TemplateBinding UIElement.IsKeyboardFocusWithin}" RenderMouseOver="{TemplateBinding UIElement.IsMouseOver}" SnapsToDevicePixels="True">
  34. <ScrollViewer Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
  35. </aero:ListBoxChrome>
  36. <ControlTemplate.Triggers>
  37. <Trigger Property="UIElement.IsEnabled" Value="False">
  38. <Setter Property="aero:ListBoxChrome.Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
  39. <Setter Property="Control.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  40. </Trigger>
  41. </ControlTemplate.Triggers>
  42. </ControlTemplate>
  43. </Setter.Value>
  44. </Setter>
  45. <Setter Property="Height" Value="40"></Setter>
  46. <Setter Property="Width" Value="190"></Setter>
  47. <Setter Property="FontSize" Value="20"></Setter>
  48. <Setter Property="Padding" Value="1,5,0,0"></Setter>
  49. <!--<Setter Property="Background">
  50. <Setter.Value>
  51. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.UI.Core;component/Resources/Login/输入框.png">
  52. </ImageBrush>
  53. </Setter.Value>
  54. </Setter>
  55. <Style.Triggers>
  56. <Trigger Property="IsFocused" Value="True">
  57. <Setter Property="Background">
  58. <Setter.Value>
  59. <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.UI.Core;component/Resources/Login/输入框_选择.png">
  60. </ImageBrush>
  61. </Setter.Value>
  62. </Setter>
  63. </Trigger>
  64. </Style.Triggers>-->
  65. </Style>
  66. <!--Notch文本框样式-->
  67. <Style TargetType="{x:Type TextBox}" x:Key="NotchTextBox">
  68. <Setter Property="VerticalContentAlignment" Value="Center"/>
  69. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  70. <Setter Property="Width" Value="50"/>
  71. <Setter Property="Height" Value="50"/>
  72. <Setter Property="Template">
  73. <Setter.Value>
  74. <ControlTemplate TargetType="{x:Type TextBox}">
  75. <Grid x:Name="grid">
  76. <Rectangle x:Name="rectangle1" RadiusX="25" RadiusY="25" Fill="{TemplateBinding Background}" StrokeThickness="1" Stroke="Black"/>
  77. <ScrollViewer x:Name="PART_ContentHost"
  78. HorizontalScrollBarVisibility="Hidden"
  79. VerticalScrollBarVisibility="Hidden"
  80. Padding="{TemplateBinding Padding}"
  81. Focusable="false">
  82. </ScrollViewer>
  83. </Grid>
  84. </ControlTemplate>
  85. </Setter.Value>
  86. </Setter>
  87. </Style>
  88. <!--反应腔盖-->
  89. <Style TargetType="TextBox" x:Key="ReactorMiniTextBox">
  90. <Setter Property="Width" Value="30" />
  91. <Setter Property="Cursor" Value="Hand" />
  92. </Style>
  93. </ResourceDictionary>