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:
[TelerikToolboxCategory("Editors")]
public class RadValidationProvider : Component, IComponent, IDisposable, ISupportInitialize, IExtenderProvider
Inheritance: objectMarshalByRefObjectComponentRadValidationProvider
Implements:
Constructors
Initializes a new instance of the RadValidationProvider class.
public RadValidationProvider()
Initializes a new instance of the RadValidationProvider class with the specified container control.
public RadValidationProvider(IContainer container)
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.
[Browsable(false)]
public List<RadEditorControl> AssociatedControls { get; }
Gets or sets the validation mode that determines when validation should be triggered for associated controls.
public ValidationMode ValidationMode { get; set; }
Gets or sets the collection of validation rules that define the validation criteria for associated RadEditorControl instances.
public FilterDescriptorCollection ValidationRules { get; set; }
Methods
Signals the start of initialization for the validation provider component.
public void BeginInit()
Implements:
Indicates whether a control can be extended by this provider. Specifies whether this object can provide its extender properties to the specified object.
public bool CanExtend(object extendee)
The object to be checked for extension capability.
Returns:true if the object can be extended (is a RadEditorControl); otherwise false.
Implements:
Clears the visual indication for validation errors on all associated controls.
public virtual void ClearErrorStatus()
Clears the visual indication for validation errors on the specified control.
public virtual void ClearErrorStatus(RadControl associatedControl)
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.
public void EndInit()
Implements:
Creates and fires a validation event with the specified parameters and returns the configured event arguments.
protected virtual RadValidationEventArgs FireValidationEvent(bool isNotValid, RadControl associatedControl, IRadValidationRule rule)
true if validation has failed; otherwise false.
associatedControlRadControlThe RadControl being validated.
ruleIRadValidationRuleThe IRadValidationRule that was evaluated.
Returns:A configured RadValidationEventArgs object containing validation results and settings.
Gets the alignment of the error icon for the specified RadEditorControl.
public ErrorIconAlignment GetIconAlignment(RadEditorControl control)
A target RadEditorControl for which to retrieve the icon alignment.
Returns: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.
public Padding GetIconPadding(RadEditorControl control)
The RadEditorControl to get the padding for.
Returns:The padding to leave between the icon and the control.
Returns the first validation rule associated with the specified RadEditorControl descendant.
public FilterDescriptor GetValidationRule(RadEditorControl control)
A RadEditorControl descendant for which to retrieve the validation rule.
Returns: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.
protected virtual void OnControlValidation(RadValidationEventArgs e)
A RadValidationEventArgs that contains the event data.
Removes a specific RadEditorControl from all validation rules in the provider.
public void RemoveControlFromRules(RadEditorControl editorControl)
A RadEditorControl descendant to remove from all validation rules.
Removes all validation rules associated with the specified RadEditorControl.
public void RemoveRules(RadEditorControl control)
A RadEditorControl descendant for which to remove all associated rules.
Removes a specific validation rule association with the specified RadEditorControl descendant.
public void RemoveValidationRule(RadEditorControl editorControl, IRadValidationRule ruleToRemove)
A RadEditorControl descendant to remove from the rule.
ruleToRemoveIRadValidationRuleThe validation rule to disassociate from the control.
Sets the alignment of the error icon for the specified RadEditorControl.
public void SetIconAlignment(RadEditorControl control, ErrorIconAlignment errorIconAlignment)
A target RadEditorControl for which to set the icon alignment.
errorIconAlignmentErrorIconAlignmentAn 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.
public void SetIconPadding(RadEditorControl control, Padding errorIconPadding)
The RadEditorControl to set the padding for.
errorIconPaddingPaddingThe padding to add between the icon and the control.
Associates a validation rule with the specified RadEditorControl descendant.
public void SetValidationRule(RadEditorControl control, FilterDescriptor rule)
A RadEditorControl descendant that represents the editor.
ruleFilterDescriptorAn IRadValidationRule that represents the validation rule to associate.
Shows a custom tooltip for validation errors with the specified parameters and styling.
protected virtual void ShowToolTip(RadControl associatedControl, string toolTipText, string toolTipTitle, int toolTipX, int toolTipY, int toolTipDuration, bool enableToolTipShadow)
The RadControl to display the tooltip on.
toolTipTextstringThe text content of the tooltip.
toolTipTitlestringThe title text of the tooltip.
toolTipXintThe X coordinate position for the tooltip.
toolTipYintThe Y coordinate position for the tooltip.
toolTipDurationintThe duration in milliseconds to display the tooltip.
enableToolTipShadowbooltrue to enable shadow effect on the tooltip; otherwise false.
Validates the specified editor control against all associated validation rules.
public bool Validate(RadEditorControl control)
A RadEditorControl or descendant that represents the editor to be validated.
Returns: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.
public event RadValidationEventHandler ControlValidation
Occurs when the ValidationMode property has changed, notifying subscribers of the validation timing change.
public event EventHandler ValidationModeChanged