Version

UltraValidator Class

Windows Forms component which extends validation functionality to controls which support value editing.
Syntax
'Declaration
 
Public Class UltraValidator 
   Inherits Infragistics.Win.UltraComponentBase
   Implements Infragistics.Shared.IUltraComponent, Infragistics.Win.IUltraValidator 
public class UltraValidator : Infragistics.Win.UltraComponentBase, Infragistics.Shared.IUltraComponent, Infragistics.Win.IUltraValidator  
Remarks

The UltraValidator component provides the ability to solve most common validation problems in a declarative manner. For typical validation scenarios such as ensuring that a number falls within a given range, or that a text field is non-empty, or conforms to the character pattern for a postal code, email address or telephone number, no code whatsoever needs to be written by the end developer. The designer support extended by the component is adequate for implementing these common solutions.

The UltraValidator component extends its functionality to all Windows Forms controls via the IExtenderProvider interface, which is utilized by Visual Studio to provide "extender properties". When an UltraValidator component is instantiated in design mode, a ValidationSettings instance is extended to every control on the form. This object encapsulates most of the validation functionality provided by the component; since each control uses a separate instance, most aspects of the validation are customizable on a per-control basis. Validation of embeddable editors is also supported; this is accomplished by assigning a reference to an editor provider control such as an UltraTextEditor or UltraComboEditor to the EditorControl property of (for example) an UltraGridColumn or UltraTreeNodeColumn, then using the ValidationSettings instance extended to the editor provider control to customize the validation behavior for the grid/tree cell.

Validation criteria is specified using the properties of the object. A required field condition can be enforced by setting the IsRequired property to true; values are evaluated using the EmptyValueCriteria property; if a value is determined by that definition to be null or empty, validation fails, causing the ValidationError event to fire. The Condition property is used to specify more complex validation criteria, such as whether a value lies within a given range. The property is of type ICondition, an interface that was created to solve the problem of row filtering for the UltraGrid control. The interface exposes only one method, Matches, which returns a boolean value that indicates whether the value meets the criteria defined by the condition. When a validation occurs, this method is called, and its return value determines whether the validation succeeds or fails. There are several concrete implementations defined in the Infragistics framework that can be assigned to this property (see Infragistics.Win.OperatorCondition, Infragistics.Win.RangeCondition, Infragistics.Win.ContainedInListCondition, Infragistics.Win.ConditionGroup). Most typical validation problems can be solved with an instance of one of these classes; for more complex validation scenarios, such as those defined by the business logic layer, a custom implementation of the ICondition interface can be assigned.

The UltraValidator component provides several different kinds of notifications to alert an end user of a failed validation. By default, an error image is displayed alongside the right edge of the validated control, which displays a balloon tip when the cursor is hovered over the image. Unlike the ErrorProvider component, which only supports the display of an Icon, UltraValidator provides the ability to display an image, with full support for complete and partial transparency. Alternatively, a MessageBox or balloon tip can be displayed, or a sound can be played. An ErrorAppearance is provided so that validation errors can be visually depicted in an embeddable editor, using the familiar Infragistics appearance model.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also