I have a style applied to a TextBox
. The style contains two triggers - both of which check the property Validation.HasError
. A different image is displayed on the background of the TextBox
indicating if the data is valid or not.
I'm trying to change the style so that when the TextBox
is empty, no image is displayed in the background. I was hoping to find another property to use in the trigger that would allow me to check if it is empty or not, but I can't find one.
Am I going about this the wrong way? Here is the style as it is currently:
<Style x:Key="ValidationTextBox" TargetType="TextBox">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="false">
<Setter Property="TextBox.Background">
<Setter.Value>
<ImageBrush ImageSource="fieldWhite_check.png" AlignmentX="Right" AlignmentY="Top" Stretch="None" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="TextBox.Background">
<Setter.Value>
<ImageBrush ImageSource="fieldWhite_error.png" AlignmentX="Right" AlignmentY="Top" Stretch="None" />
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>