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.v25.2.dll
NuGet Package: DevExpress.Xpo
Declaration
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;
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ListChanged 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.