Skip to main content
.NET Framework 4.5.2+

IObjectSpace.ModifiedChanged Event

Occurs when the current Object Space’s IObjectSpace.IsModified state is changed.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v21.2.dll

Declaration

event EventHandler ModifiedChanged

Event Data

The ModifiedChanged event's data class is EventArgs.

Remarks

In the BaseObjectSpace descendant, you don’t have to raise the ModifiedChanged event. It is raised in the protected BaseObjectSpace.SetIsModified method after the BaseObjectSpace.IsModified property has changed.

Handle this event to execute custom code when the Object Space’s Modified state is changed. However, it is already handled internally to change Actions states in dependence of the IObjectSpace.IsModified property value.

The following code disables an Action when business objects in the current Object Space are changed.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using System;
// ...
public class ViewController1 : ViewController {
    SimpleAction action1;
    public ViewController1() {
        action1 = new SimpleAction(this, "Action1", DevExpress.Persistent.Base.PredefinedCategory.View);
    }
    protected override void OnActivated() {
        base.OnActivated();
        ObjectSpace.ModifiedChanged += ObjectSpace_ModifiedChanged;
        UpdateActionState();
    }
    void ObjectSpace_ModifiedChanged(object sender, EventArgs e) {
        UpdateActionState();
    }
    protected virtual void UpdateActionState() {
        action1.Enabled["ObjectSpaceIsModified"] = !ObjectSpace.IsModified;
    }
    protected override void OnDeactivated() {
        base.OnDeactivated();
        ObjectSpace.ModifiedChanged -= ObjectSpace_ModifiedChanged;
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ModifiedChanged event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also