.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET 5.0+

CollectionSourceBase.Collection Property

Provides access to the Collection Source’s (see CollectionSourceBase) collection of objects.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v21.2.dll

Declaration

public object Collection { get; }

Property Value

Type Description
Object

An object representing the Collection Source’s collection of objects.

Remarks

Use this property to access the Collection Source’s collection. A Collection Source’s Collection holds the objects retrieved from a data source by an Object Space and displayed by a List View in a UI. You may need to access a Collection Source’s collection, for example, to filter a List View on the data source level. To learn how to do it, refer to the Criteria Property of a List View’s Collection Source topic.

The following table lists the events related to the Collection Source’s collection.

Event Description
CollectionSourceBase.CollectionChanging Occurs before the collection has been recreated.
CollectionSourceBase.CollectionChanged Occurs after the collection has been recreated.
CollectionSourceBase.CollectionReloading Occurs before the collection has been reloaded.
CollectionSourceBase.CollectionReloaded Occurs after the collection has been reloaded.
CollectionSourceBase.CriteriaApplying Occurs before the collection has been filtered using the criteria defined in the CollectionSourceBase.Criteria dictionary.
CollectionSourceBase.CriteriaApplied Occurs after the collection has been filtered using the criteria defined in the CollectionSourceBase.Criteria dictionary.

Note, that while View Controllers are activating for a List View, the List View’s CollectionSourceBase.Collection property may return null. So, if you need to access a Collection Source’s collection in a View Controller, do not perform the collection-dependent code after the Controller has been activated. Instead, subscribe to the CollectionSourceBase.CollectionChanged event, and perform your code in the event handler.

If the object returned by this property does not implement the IEnumerable interface, but you need to iterated through the retrieved objects, use the CollectionSourceBase.List property.

Be aware in which mode the current Collection’s Collection Source is created: CollectionSourceBase.DataAccessMode and CollectionSourceBase.Mode. This influences which objects are currently retrieved to the Collection.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Collection property.

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