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

SortingCollection.Add(SortingCollection) Method

Adds the SortProperty objects from the specified collection.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v20.1.dll

Declaration

public void Add(
    SortingCollection sortProperties
)
Public Sub Add(
    sortProperties As SortingCollection
)

Parameters

Name Type Description
sortProperties SortingCollection

A SortingCollection object which represents the collection whose elements are added to the current collection.

Remarks

Adding an element to the collection doesn't automatically apply sorting by the corresponding property (column). To re-sort data, create a new SortingCollection object, populate it with customized SortProperty objects and reassign it to the XPBaseCollection.Sorting property.

Examples

The following example demonstrates how to sort a collection (xpCollectionPerson) in ascending order against a 'Name' field.

using DevExpress.Xpo;
using DevExpress.Xpo.DB;

SortingCollection sortCollection = new SortingCollection();
sortCollection.Add(new SortProperty("Name", SortingDirection.Ascending));
xpCollectionPerson.Sorting = sortCollection;
See Also