SortingCollection.Add(SortProperty) Method
Adds the specified SortProperty object to the collection.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
sortProperty | SortProperty | A SortProperty object to add to the 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 the 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;
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Add(SortProperty) method.
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.