The way to do this is to bind the width of the TextBox in the CueBannerBrush (your VisualBrush) to the main parent of the TextBox (txtboxSearch).
However, this only works if you put the CueBannerBrush definition in control resources or windows, and not in TextBox.Style resources:
<Window.Resources> <VisualBrush x:Key="CueBannerBrush" TileMode="Tile" Stretch="None" AlignmentX="Left" AlignmentY="Center" > <VisualBrush.Visual> <TextBox Width="{Binding ElementName=txtboxSearch, Path=ActualWidth}" HorizontalAlignment="Stretch" x:Name="txtboxWatermark" Text="Search" Foreground="LightGray" FontStyle="Italic"/> </VisualBrush.Visual> </VisualBrush> </Window.Resources>
And then your main XAML will be the same, but without a VisualBrush definition.
<Grid Background="Tomato"> <TextBox x:Name="txtboxSearch" Height="22" Margin="3,35,111,0" TextWrapping="Wrap" VerticalAlignment="Top" BorderThickness="1" MaxLines="1" MaxLength="256" Grid.Column="2" BorderBrush="#FF828790"> <TextBox.Style> <Style TargetType="TextBox"> <Style.Triggers> <Trigger Property="Text" Value="{x:Static sys:String.Empty}"> <Setter Property="Background" Value="{StaticResource CueBannerBrush}" /> </Trigger> <Trigger Property="Text" Value="{x:Null}"> <Setter Property="Background" Value="{StaticResource CueBannerBrush}" /> </Trigger> <Trigger Property="IsKeyboardFocused" Value="True"> <Setter Property="Background" Value="White" /> </Trigger> </Style.Triggers> </Style> </TextBox.Style> </TextBox> </Grid>
Now you will see this initially: 
And when you click inside it: 
source share