Skip to main content
.NET Framework 4.6.2+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

RuleSet.ValidationCompleted Event

Occurs after validation of an entire RuleSet is complete.

Namespace: DevExpress.Persistent.Validation

Assembly: DevExpress.Persistent.Base.v24.2.dll

#Declaration

#Event Data

The ValidationCompleted event's data class is ValidationCompletedEventArgs. The following properties provide information specific to this event:

Property Description
Exception Specifies a validation exception that will be raised if the validation is unsuccessful.
Handled Gets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing. Inherited from HandledEventArgs.
ObjectSpace Returns an IObjectSpace used by the RuleSet.
Result Returns the result of the entire RuleSet validation.
SourceFrame The Frame of the Controller that validates objects. Only WinForms applications use this property.
Successful Indicates if the validation was successful.

#Remarks

Handle this event to change or remove the ValidationCompletedEventArgs.Exception.

The following example demonstrates how to hide the ObjectHeaderFormat part of the validation message:

using System;
using DevExpress.ExpressApp;
using DevExpress.Persistent.Validation;

namespace MySolution.Module.Controllers {
    public class CustomizeValidationMessageController : WindowController {
        public CustomizeValidationMessageController() {
            TargetWindowType = WindowType.Main;
        }
        protected override void OnActivated() {
            base.OnActivated();
            Validator.RuleSet.ValidationCompleted += new EventHandler<ValidationCompletedEventArgs>(RuleSet_ValidationCompleted);
        }
        void RuleSet_ValidationCompleted(object sender, ValidationCompletedEventArgs e) {
            if (e.Exception != null) {
                e.Exception.ObjectHeaderFormat = "";
            }
        }
        protected override void OnDeactivated() {
            base.OnDeactivated();
            Validator.RuleSet.ValidationCompleted -= new EventHandler<ValidationCompletedEventArgs>(RuleSet_ValidationCompleted);
        }
    }
}

If the validation was performed by the RuleSet.ValidateTarget or RuleSet.ValidateAllTargets method, the ValidationCompleted event is not raised.

See Also