Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

XPBaseCollection.CollectionChanged Event

Occurs when an item is added to, or removed from the XPBaseCollection (when the XPBaseCollection.BaseAdd or XPBaseCollection.BaseRemove method is called).

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v19.2.dll

Declaration

public event XPCollectionChangedEventHandler CollectionChanged

Event Data

The CollectionChanged event's data class is XPCollectionChangedEventArgs.

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.CollectionChanged += collection_CollectionChanged;
    }
    return collection;
}
// Example for non-generic collection:
protected override XPCollection CreateCollection(XPMemberInfo property) {
    XPCollection collection = base.CreateCollection(property);
    if (property.Name == "MyCollectionProperty") {
        collection.CollectionChanged += collection_CollectionChanged;
    }
    return collection;
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the CollectionChanged 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