Back to Devexpress

RuleSet.ValidationCompleted Event

expressappframework-devexpress-dot-persistent-dot-validation-dot-ruleset-80aed3bf.md

latest5.0 KB
Original Source

RuleSet.ValidationCompleted Event

Occurs after validation of an entire RuleSet is complete.

Namespace : DevExpress.Persistent.Validation

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

NuGet Package : DevExpress.Persistent.Base

Declaration

csharp
public event EventHandler<ValidationCompletedEventArgs> ValidationCompleted
vb
Public Event ValidationCompleted As EventHandler(Of ValidationCompletedEventArgs)

Event Data

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

PropertyDescription
ExceptionSpecifies a validation exception that will be raised if the validation is unsuccessful.
HandledGets 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.
ObjectSpaceReturns an IObjectSpace used by the RuleSet.
ResultReturns the result of the entire RuleSet validation.
SourceFrameThe Frame of the Controller that validates objects. Only WinForms applications use this property.
SuccessfulIndicates 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:

csharp
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.

Note

You cannot use this event in a .NET application. Refer to the following section for more information: How to Subscribe to Validation Events

Implements

ValidationCompleted

See Also

RuleSet Class

RuleSet Members

DevExpress.Persistent.Validation Namespace