SortingCollection.Add(SortingCollection) Method
In This Article
Adds the SortProperty objects from the specified collection.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.2.dll
#Declaration
public void Add(
SortingCollection sortProperties
)
#Parameters
Name | Type | Description |
---|---|---|
sort |
Sorting |
A Sorting |
#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