Skip to main content
.NET 8.0+

XPBaseCollection.ListChanged Event

Occurs when the list or an item in the list of the XPBaseCollection collection is changed.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.2.dll

Declaration

public event ListChangedEventHandler ListChanged

Event Data

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

Property Description
ListChangedType Gets the type of change.
NewIndex Gets the index of the item affected by the change.
OldIndex Gets the old index of an item that has been moved.
PropertyDescriptor Gets the PropertyDescriptor that was added, changed, or deleted.

Remarks

To subscribe to this event, override the XPBaseObject.CreateCollection<T> or PersistentBase.CreateCollection method of your persistent class.

// Example for generic collection:
protected override XPCollection<T> CreateCollection<T>(XPMemberInfo property) {
    XPCollection<T> collection = base.CreateCollection<T>(property);
    if (property.Name == "MyGenericCollectionProperty") {
        collection.ListChanged += collection_ListChanged;
    }
    return collection;
}
// Example for non-generic collection:
protected override XPCollection CreateCollection(XPMemberInfo property) {
    XPCollection collection = base.CreateCollection(property);
    if (property.Name == "MyCollectionProperty") {
        collection.ListChanged += collection_ListChanged;
    }
    return collection;
}
See Also