In addition to the essential
HasError properties, the
Validation class also declares an
ErrorTemplate Attached Property of type
ControlTemplate. The default template assigned to this property is responsible for defining the red rectangle that surrounds UI fields that have validation errors associated with them.
However, this property enables us to change this template and so, we are able to define how validation errors are highlighted to the application users. As this property is an Attached Property, this effectively means that we could apply a different template to be displayed for each control in the UI. However, this cannot be recommended, because it could make the application look less consistent.
This template actually uses an
Adorner element to render its graphics in the adorner layer on top of the related control in error. Therefore, in order to specify where our error visual(s) should be rendered in relation to the related control, we need...