Skip to main content
All docs
V25.1
  • .NET 8.0+

    ValidationModule.CustomInitializeRuleSet Event

    Replaces the default InitializeRuleSet() implementation with custom logic.

    Namespace: DevExpress.ExpressApp.Validation

    Assembly: DevExpress.ExpressApp.Validation.v25.1.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