StyleTextBox.xaml 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  3. <Style TargetType="TextBox">
  4. <Setter Property="FontSize" Value="14"/>
  5. <Setter Property="Height" Value="40"/>
  6. <Setter Property="Width" Value="250"/>
  7. <Setter Property="Background" Value="white"/>
  8. <Setter Property="Foreground" Value="#59A862"/>
  9. <Setter Property="FontWeight" Value="UltraLight"/>
  10. <Setter Property="Padding" Value="0 5 5 4"/>
  11. <Setter Property="Margin" Value="10 5"/>
  12. <Setter Property="Cursor" Value="IBeam"/>
  13. <Setter Property="VerticalContentAlignment" Value="Center"/>
  14. <Setter Property="HorizontalAlignment" Value="Center"/>
  15. <Setter Property="VerticalAlignment" Value="Center"/>
  16. <Setter Property="Grid.Column" Value="1"/>
  17. <Setter Property="Template">
  18. <Setter.Value>
  19. <ControlTemplate TargetType="{x:Type TextBox}">
  20. <Border x:Name="TxtBorder"
  21. Background="{TemplateBinding Background}"
  22. BorderBrush="{TemplateBinding BorderBrush}"
  23. BorderThickness="{TemplateBinding BorderThickness}"
  24. CornerRadius="5"
  25. SnapsToDevicePixels="True">
  26. <Grid Margin="{TemplateBinding Padding}">
  27. <Grid.ColumnDefinitions>
  28. <ColumnDefinition Width="*"/>
  29. </Grid.ColumnDefinitions>
  30. <ScrollViewer x:Name="PART_ContentHost"
  31. Focusable="False"
  32. Grid.Column="1"
  33. Margin="5 0 0 0"
  34. HorizontalScrollBarVisibility="Hidden"
  35. VerticalScrollBarVisibility="Hidden"/>
  36. <Label x:Name="Watermark"
  37. FontFamily="Gabriela"
  38. FontSize="15"
  39. VerticalAlignment="Center"
  40. HorizontalAlignment="Left"
  41. Foreground="#59A862"
  42. Visibility="Collapsed"
  43. Padding="5 0 20 0"
  44. Content="{TemplateBinding Tag}"
  45. Grid.Column="1"/>
  46. </Grid>
  47. </Border>
  48. <ControlTemplate.Triggers>
  49. <Trigger Property="IsMouseOver" Value="True">
  50. <Setter Property="BorderBrush" Value="#498C51" TargetName="TxtBorder"/>
  51. <Setter Property="Control.Foreground" Value="#498C51"/>
  52. <Setter Property="Foreground" TargetName="Watermark" Value="#498C51"/>
  53. </Trigger>
  54. <Trigger Property="IsKeyboardFocused" Value="True">
  55. <Setter Property="Control.Foreground" Value="#498C51"/>
  56. <Setter Property="BorderBrush" Value="#498C51" TargetName="TxtBorder"/>
  57. <Setter Property="Foreground" TargetName="Watermark" Value="#498C51"/>
  58. </Trigger>
  59. <MultiTrigger>
  60. <MultiTrigger.Conditions>
  61. <Condition Property="Text" Value=""/>
  62. </MultiTrigger.Conditions>
  63. <Setter Property="Visibility" Value="Visible" TargetName="Watermark"/>
  64. </MultiTrigger>
  65. </ControlTemplate.Triggers>
  66. </ControlTemplate>
  67. </Setter.Value>
  68. </Setter>
  69. </Style>
  70. </ResourceDictionary>