New to Telerik UI for WinFormsStart a free 30-day trial

Provides a validation management framework for RadEditorControl descendant editors, enabling the creation and enforcement of validation rules with visual error indicators and tooltips.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
[TelerikToolboxCategory("Editors")]
public class RadValidationProvider : Component, IComponent, IDisposable, ISupportInitialize, IExtenderProvider

Inheritance: objectMarshalByRefObjectComponentRadValidationProvider

Implements: IComponentIDisposableIExtenderProviderISupportInitialize

Constructors

Initializes a new instance of the RadValidationProvider class.

C#
public RadValidationProvider()

Initializes a new instance of the RadValidationProvider class with the specified container control.

C#
public RadValidationProvider(IContainer container)
Parameters:containerIContainer

An object that implements the IContainer interface, and owns the created object.

Properties

Gets a collection of all RadEditorControl instances that have validation rules associated with them.

C#
[Browsable(false)]
public List<RadEditorControl> AssociatedControls { get; }

Gets or sets the validation mode that determines when validation should be triggered for associated controls.

C#
public ValidationMode ValidationMode { get; set; }

Gets or sets the collection of validation rules that define the validation criteria for associated RadEditorControl instances.

C#
public FilterDescriptorCollection ValidationRules { get; set; }

Methods

Signals the start of initialization for the validation provider component.

C#
public void BeginInit()

Implements: ISupportInitialize.BeginInit()

Indicates whether a control can be extended by this provider. Specifies whether this object can provide its extender properties to the specified object.

C#
public bool CanExtend(object extendee)
Parameters:extendeeobject

The object to be checked for extension capability.

Returns:

bool

true if the object can be extended (is a RadEditorControl); otherwise false.

Implements: IExtenderProvider.CanExtend(object)

Clears the visual indication for validation errors on all associated controls.

C#
public virtual void ClearErrorStatus()

Clears the visual indication for validation errors on the specified control.

C#
public virtual void ClearErrorStatus(RadControl associatedControl)
Parameters:associatedControlRadControl

A RadControl descendant for which to clear the error status.

Signals the end of initialization for the validation provider component and ensures proper event subscription.

C#
public void EndInit()

Implements: ISupportInitialize.EndInit()

Creates and fires a validation event with the specified parameters and returns the configured event arguments.

C#
protected virtual RadValidationEventArgs FireValidationEvent(bool isNotValid, RadControl associatedControl, IRadValidationRule rule)
Parameters:isNotValidbool

true if validation has failed; otherwise false.

associatedControlRadControl

The RadControl being validated.

ruleIRadValidationRule

The IRadValidationRule that was evaluated.

Returns:

RadValidationEventArgs

A configured RadValidationEventArgs object containing validation results and settings.

Gets the alignment of the error icon for the specified RadEditorControl.

C#
public ErrorIconAlignment GetIconAlignment(RadEditorControl control)
Parameters:controlRadEditorControl

A target RadEditorControl for which to retrieve the icon alignment.

Returns:

ErrorIconAlignment

An ErrorIconAlignment value representing the current alignment setting for the control.

Returns the amount of extra space to leave next to the error icon for the specified control.

C#
public Padding GetIconPadding(RadEditorControl control)
Parameters:controlRadEditorControl

The RadEditorControl to get the padding for.

Returns:

Padding

The padding to leave between the icon and the control.

Returns the first validation rule associated with the specified RadEditorControl descendant.

C#
public FilterDescriptor GetValidationRule(RadEditorControl control)
Parameters:controlRadEditorControl

A RadEditorControl descendant for which to retrieve the validation rule.

Returns:

FilterDescriptor

An IRadValidationRule that represents the validation rule associated with the editor, or null if no validation rule is associated with the specified control.

Raises the ControlValidation event with the specified validation event arguments.

C#
protected virtual void OnControlValidation(RadValidationEventArgs e)
Parameters:eRadValidationEventArgs

A RadValidationEventArgs that contains the event data.

Removes a specific RadEditorControl from all validation rules in the provider.

C#
public void RemoveControlFromRules(RadEditorControl editorControl)
Parameters:editorControlRadEditorControl

A RadEditorControl descendant to remove from all validation rules.

Removes all validation rules associated with the specified RadEditorControl.

C#
public void RemoveRules(RadEditorControl control)
Parameters:controlRadEditorControl

A RadEditorControl descendant for which to remove all associated rules.

Removes a specific validation rule association with the specified RadEditorControl descendant.

C#
public void RemoveValidationRule(RadEditorControl editorControl, IRadValidationRule ruleToRemove)
Parameters:editorControlRadEditorControl

A RadEditorControl descendant to remove from the rule.

ruleToRemoveIRadValidationRule

The validation rule to disassociate from the control.

Sets the alignment of the error icon for the specified RadEditorControl.

C#
public void SetIconAlignment(RadEditorControl control, ErrorIconAlignment errorIconAlignment)
Parameters:controlRadEditorControl

A target RadEditorControl for which to set the icon alignment.

errorIconAlignmentErrorIconAlignment

An ErrorIconAlignment value that specifies the alignment to be set for the control.

Sets the amount of extra space to leave between the specified control and the error icon.

C#
public void SetIconPadding(RadEditorControl control, Padding errorIconPadding)
Parameters:controlRadEditorControl

The RadEditorControl to set the padding for.

errorIconPaddingPadding

The padding to add between the icon and the control.

Associates a validation rule with the specified RadEditorControl descendant.

C#
public void SetValidationRule(RadEditorControl control, FilterDescriptor rule)
Parameters:controlRadEditorControl

A RadEditorControl descendant that represents the editor.

ruleFilterDescriptor

An IRadValidationRule that represents the validation rule to associate.

Shows a custom tooltip for validation errors with the specified parameters and styling.

C#
protected virtual void ShowToolTip(RadControl associatedControl, string toolTipText, string toolTipTitle, int toolTipX, int toolTipY, int toolTipDuration, bool enableToolTipShadow)
Parameters:associatedControlRadControl

The RadControl to display the tooltip on.

toolTipTextstring

The text content of the tooltip.

toolTipTitlestring

The title text of the tooltip.

toolTipXint

The X coordinate position for the tooltip.

toolTipYint

The Y coordinate position for the tooltip.

toolTipDurationint

The duration in milliseconds to display the tooltip.

enableToolTipShadowbool

true to enable shadow effect on the tooltip; otherwise false.

Validates the specified editor control against all associated validation rules.

C#
public bool Validate(RadEditorControl control)
Parameters:controlRadEditorControl

A RadEditorControl or descendant that represents the editor to be validated.

Returns:

bool

true if the editor has been successfully validated against all rules; otherwise false.

Events

Occurs before a RadEditorControl is being validated, allowing custom validation logic and error handling.

C#
public event RadValidationEventHandler ControlValidation

Occurs when the ValidationMode property has changed, notifying subscribers of the validation timing change.

C#
public event EventHandler ValidationModeChanged