SortDescription Class
Specifies how to sort CollectionView items.
Namespace: DevExpress.Maui.CollectionView
Assembly: DevExpress.Maui.CollectionView.dll
NuGet Package: DevExpress.Maui.CollectionView
Declaration
public class SortDescription :
SortDescriptionBase
Remarks
You can apply multiple sorting rules to collection view items. The rules are applied in the same order they have in the SortDescriptions collection.
To configure a sorting rule, create a SortDescription
object and specify its options:
- FieldName
- Defines the name of the data source field whose values are used to sort items.
- SortOrder
- Specifies whether items should be in ascending or descending order.
Then, add the SortDescription
object to the SortDescriptions collection.
To group collection view items, specify the DXCollectionView.GroupDescription property.
For more information on how to shape collection view data, refer to the following help topic: Filter, Sort, and Group Data in Collection View for .NET MAUI.
Example
The following example sorts collection view items in descending order:
<dxcv:DXCollectionView ...>
<dxcv:DXCollectionView.SortDescriptions>
<dxcv:SortDescription FieldName="Name" SortOrder="Descending"/>
</dxcv:DXCollectionView.SortDescriptions>
</dxcv:DXCollectionView>