Skip to main content
.NET 6.0+

BaseObjectSpace.ModifiedChanging Event

Occurs before the IsModified property is changed to true. Handle this event to cancel the property change or force the IsModified property to change.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public event EventHandler<ObjectSpaceModificationEventArgs> ModifiedChanging

Event Data

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

Property Description
Cancel Specifies whether the IsModified property change must be canceled.
MemberInfo Specifies an object that is information on the property whose value has been changed. Inherited from ObjectChangedEventArgs.
NewValue Specifies the new value of a changed property. Inherited from ObjectChangedEventArgs.
Object Provides access to the object that is being manipulated. Inherited from ObjectManipulatingEventArgs.
OldValue Specifies the old value of a changed property. Inherited from ObjectChangedEventArgs.
PropertyName Specifies the name of a property whose value has been changed. Returns null (Nothing in VB) if it is impossible to determine what property causes the change. Inherited from ObjectChangedEventArgs.

Remarks

The following example shows how to cancel the IsModified property change when you modify the Category property of a ProductView object. In this case, the current Object Space does not add this object to the ModifiedObjects collection.

File: MySolution.Blazor.Server/Startup.cs, MySolution.Win/Startup.cs, MySolution.WebApi/Startup.cs

using DevExpress.ExpressApp;
// ...
builder.ObjectSpaceProviders.Events.OnObjectSpaceCreated = context => {
    var npos = context.ObjectSpace as NonPersistentObjectSpace;
    if (npos != null) {
        npos.ModifiedChanging += Npos_ModifiedChanging;
    }
};
// ...
private void Npos_ModifiedChanging(object sender, ObjectSpaceModificationEventArgs e) {
    if(e.MemberInfo!= null) {
        if(e.MemberInfo.Owner.Type == typeof(ProductView) && 
        e.MemberInfo.Name == nameof(ProductView.Category)) {
            e.Cancel = true;
        }
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ModifiedChanging 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