.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET 5.0+

RuleSet.ValidationCompleted Event

Occurs after validation of an entire RuleSet is complete.

Namespace: DevExpress.Persistent.Validation

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

Declaration

public event EventHandler<ValidationCompletedEventArgs> ValidationCompleted

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