Skip to main content
All docs
V24.2
.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

ValidationModule.CustomInitializeRuleSet Event

Replaces the default InitializeRuleSet() implementation with custom logic.

Namespace: DevExpress.ExpressApp.Validation

Assembly: DevExpress.ExpressApp.Validation.v24.2.dll

#Declaration

public event EventHandler<HandledEventArgs> CustomInitializeRuleSet

#Event Data

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

Property Description
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.

#Remarks

To replace the ValidationModule.InitializeRuleSet method’s default logic, handle the ValidationModule.CustomInitializeRuleSet event and set its Handled argument to true in your Module. The following example demonstrates how to handle this event in the MySolution.Module project:

File: MySolution.Module\Module.cs.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Validation;
using System;
using System.ComponentModel;
// ...
public sealed partial class MySolutionModule : ModuleBase {
    // ...
    public override void Setup(XafApplication application) {
        base.Setup(application);
        application.SetupComplete += Application_SetupComplete;
    }
    private void Application_SetupComplete(object sender, EventArgs e) {
        ValidationModule vModule = (ValidationModule)Application.Modules.FindModule(typeof(ValidationModule));
        if(vModule != null) {
            vModule.CustomInitializeRuleSet += ValidationModule_CustomInitializeRuleSet;
        }
    }
    private void ValidationModule_CustomInitializeRuleSet(object sender, HandledEventArgs e) {
        // custom logic
        e.Handled = true;
    }
}
See Also