Skip to main content
.NET Framework 4.5.2+

SortingCollection.Add(SortingCollection) Method

Adds the SortProperty objects from the specified collection.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.1.dll

NuGet Package: DevExpress.Xpo

Declaration

public void Add(
    SortingCollection sortProperties
)

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.

Example

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