The requested page is not available for the requested platform. You are viewing the content for Default platform.

ValidationModule.CustomizeApplicationRuntimeRules Event

Occurs when the ValidationModule.InitializeRuleSet method is invoked.

Namespace: DevExpress.ExpressApp.Validation

Assembly: DevExpress.ExpressApp.Validation.v19.1.dll


public event EventHandler<CustomizeApplicationRuntimeRulesEventArgs> CustomizeApplicationRuntimeRules
Public Event CustomizeApplicationRuntimeRules As EventHandler(Of CustomizeApplicationRuntimeRulesEventArgs)

Event Data

The CustomizeApplicationRuntimeRules event handler receives an argument of the CustomizeApplicationRuntimeRulesEventArgs type. The following properties provide information specific to this event.

Property Description
Application Specifies the object providing methods and properties to manage the current application.
(Inherited from CustomizeRulesEventArgs)
ApplicationModelRuleSet Specifies validation rules declared via the Application Model.
ObjectSpaceProvider Specifies the Object Space Provider to be used to create Object Spaces for creation of additional validation rules.
Rules Specifies additional validation rules to be used by the application.
(Inherited from CustomizeRulesEventArgs)
RuleSources Specifies additional validation rule sources to be used by the application.
(Inherited from CustomizeRulesEventArgs)


Handle this event to create validation rules at run time. Add the required rules to the Rules collection. The following code snippet demonstrates how to create a validation rule at run time, ensuring that an end-user will not be able to save a Contact object unless its Anniversary property is specified.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Validation;
using DevExpress.Persistent.Validation;
public sealed partial class MyModule : ModuleBase {
    ValidationModule validationModule;
    public MyModule() {
    public override void Setup(ApplicationModulesManager moduleManager) {
        validationModule = moduleManager.Modules.FindModule<ValidationModule>();
        validationModule.CustomizeApplicationRuntimeRules += OnCustomizeRules;
    void OnCustomizeRules(object sender, CustomizeApplicationRuntimeRulesEventArgs e) {
        RuleRequiredField myRule =
            new RuleRequiredField("myRule", 
        validationModule.CustomizeApplicationRuntimeRules -= OnCustomizeRules;
        validationModule = null;
See Also