<!-- lang: xml -->
<TextBox>
<TextBox.Resources>
<VisualBrush x:Key="HelpBrush" TileMode="None" Opacity="0.3" Stretch="None" AlignmentX="Left">
<VisualBrush.Visual>
<TextBlock FontStyle="Italic" Text="Please input your usename"/>
</VisualBrush.Visual>
</VisualBrush>
</TextBox.Resources>
<TextBox.Style>
<Style TargetType="TextBox">
<Style.Triggers>
<Trigger Property="Text" Value="{x:Null}">
<Setter Property="Background" Value="{StaticResource HelpBrush}"/>
</Trigger>
<Trigger Property="Text" Value="">
<Setter Property="Background" Value="{StaticResource HelpBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
Similar Posts:
- [Solved] handycontrol: numericupdown Fail to display custom error
- [Solved] Computed property “xxxx” was assigned to but it has no setter
- Solution to invalid WPF binding elementname mode — X: reference binding
- Oracle trigger error: ORA-04098 [How to Solve]
- [Solved] Vscode css Style Error: webkit-background-clip
- [Solved] error: resource style/AppTheme (aka com.example.myapplication:style/AppTheme
- Unity3d: How to Change Font
- Zabbix Warning: Too many processes on zabbix server
- Visual Studio Failed to Start Error: throw error ‘cannot run when setup is in progress’
- event.srcElement And event.target The difference between