I have several text fields in a WPF application on which I set some validation.
Upon loading, the application deserializes the class that the WPF controls are bound to.
I have a ValidationRule that (for example) checks for a file. If I do not set ValidatesOnTargetUpdated then the corresponding TextBox checks when I change the (related) Text property, and I see (by default) a red border appears and a hint ( {Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors).CurrentItem.ErrorContent}) displays an error message.
I want the controls to check for binding, and not on PropertyChanged so I set the ValidatesOnTargetUpdated to true and can see the ValidationRule firing during debugging.
My problem is that the (default) ValidationTemplate is ignored when ValidatesOnTargetUpdated="True", despite the ValidationRule firing.
I see a hint - it appears with the correct error message, but the border does not appear as red; it seems to be ignored.
Any ideas why this is happening?
source
share