The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

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.1.dll

Declaration

public event XPCollectionChangedEventHandler CollectionChanged
Public Event CollectionChanged As XPCollectionChangedEventHandler
public event XPCollectionChangedEventHandler CollectionChanged
Public Event CollectionChanged As XPCollectionChangedEventHandler

Event Data

The CollectionChanged event handler receives an argument of the XPCollectionChangedEventArgs type.

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;
}
See Also