Hi,
how to make watermark text for text in wpf.
<Style x:Key="WaterMarkTextBoxStyle"BasedOn="{StaticResource {x:Type TextBox}}"
TargetType="{x:Type TextBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Grid>
<ScrollViewer x:Name="PART_ContentHost"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<TextBlock x:Name="textBlock"
Opacity="0.5"
Text="{TemplateBinding Tag}"
Padding="2,2,0,0"
TextWrapping="Wrap"
Visibility="Hidden" />
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Text"
Value="" />
</MultiTrigger.Conditions>
<Setter Property="Visibility"
TargetName="textBlock"
Value="Visible" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
...............................................................................
<TextBox Template="{StaticResource RoundedTextBoxControlTemplate}" Style="{StaticResource WaterMarkTextBoxStyle}" Tag="This is a test" Height="35" HorizontalAlignment="Left" Margin="315,40,0,0" Name="Search_txt" VerticalAlignment="Top" Width="350" TextChanged="Search_txt_TextChanged" GotKeyboardFocus="Search_txt_GotKeyboardFocus" TextWrapping="NoWrap" Background="LightBlue" Foreground="White" FontFamily="Raleway" FontSize="20">