1/*In xaml*/
2<!-- Place holder text -->
3 <TextBlock IsHitTestVisible="False" Text="Change text" VerticalAlignment="Top" HorizontalAlignment="Left" TextAlignment="Left" Margin="454,352,0,0" FontSize="40" Foreground="DarkGray" Width="352" Height="47">
4 <TextBlock.Style>
5 <Style TargetType="{x:Type TextBlock}">
6 <Style.Triggers>
7 <DataTrigger Binding="{Binding Text,ElementName=/*Enter the text box to bind to*/}" Value="">
8 <Setter Property="Visibility" Value="Visible" />
9 </DataTrigger>
10 </Style.Triggers>
11 <Setter Property="Visibility" Value="Hidden" />
12 </Style>
13 </TextBlock.Style>
14 </TextBlock>
15 <!-- Place holder text end -->
1<TextBox
2 x:Name="tbxSeach"
3 Grid.Row="0"
4 Grid.Column="0"
5 Height="25"
6 Margin="10,0,10,0"
7 HorizontalAlignment="Stretch"
8 VerticalAlignment="Bottom"
9 VerticalContentAlignment="Center"
10 Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
11 TextAlignment="Left">
12 <TextBox.Resources>
13 <VisualBrush
14 x:Key="hinttext"
15 AlignmentX="Left"
16 Stretch="None"
17 TileMode="None">
18 <VisualBrush.Visual>
19 <TextBlock
20 FontStyle="Italic"
21 Foreground="#959595"
22 Text="Search..." />
23 </VisualBrush.Visual>
24 </VisualBrush>
25 </TextBox.Resources>
26 <TextBox.Style>
27 <Style BasedOn="{StaticResource TextBoxBase}" TargetType="TextBox">
28 <Setter Property="VerticalAlignment" Value="Center" />
29 <Setter Property="FontSize" Value="12" />
30 <Setter Property="Background" Value="Transparent" />
31 <Style.Triggers>
32 <Trigger Property="Text" Value="">
33 <Setter Property="Background" Value="{StaticResource hinttext}" />
34 </Trigger>
35
36 <Trigger Property="Text" Value="{x:Null}">
37 <Setter Property="Background" Value="{StaticResource hinttext}" />
38 </Trigger>
39 </Style.Triggers>
40 </Style>
41 </TextBox.Style>
42 </TextBox>