I assume that you are using the WPF validation mechanism for stocks ValidationRules. If so, you should determine Triggeron Validation.HasError == trueand, if necessary, set the properties TextBox. For example, the following will highlight text in red if it is invalid.
<TextBox>
<TextBox.Text>
<Binding ...>
<Binding.ValidationRules>
...
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
<TextBox.Style>
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="True">
<Setter Property="Foreground" Value="Red" />
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
source
share