Validation Error Visual

When the control has validation errors, the border around the control will turn red and a little element will appear in the upper right corner of the control. When you hover over the element you can read the validation message. The visual appereance of the validation error comes from the Validation.ErrorTemplate attached property. Most of our controls have a predefined template for this property. The visual appearance of the error is defined inside the default template of the controls.

If you want to modify the default one, you can extract the default Validation.ErrorTemplate for the specified control and modify it per your needs. You can check the Editing Control Templates help article which describes how you can get the template of our controls.

In a case, you want to create your own error template, you can create custom ControlTemplate and assign it to the Validation.ErrorTemplate attached property.

Example 1: Custom ControlTemplate

<ControlTemplate x:Key="CustomErrorTemplate"> 
    <!-- define whatever UI needed here --> 
</ControlTemplate> 

Example 2: Custom ControlTemplate

<telerik:RadMaskedNumericInput Validation.ErrorTemplate="{StaticResource CustomErrorTemplate}" /> 

ValidationErrorTemplateHelper

By default, the validation error tooltip message will appear only when the mouse is over this element. To make the validation message appears when the control is focused, you can set the ValidationErrorTemplateHelper.ShowWhenFocused attached property to true. Its default value is false.

Show Validation Message on Focus

<telerik:RadWatermarkTextBox telerik:ValidationErrorTemplateHelper.ShowWhenFocused="True" /> 

See Also

In this article