wpf-devexpress-dot-xpf-dot-grid-dot-columnbase-0301c223.md
Gets or sets the column’s sort order. This is a dependency property.
Namespace : DevExpress.Xpf.Grid
Assembly : DevExpress.Xpf.Grid.v25.2.Core.dll
NuGet Package : DevExpress.Wpf.Grid.Core
[Browsable(false)]
public ColumnSortOrder SortOrder { get; set; }
<Browsable(False)>
Public Property SortOrder As ColumnSortOrder
| Type | Description |
|---|---|
| ColumnSortOrder |
The column’s sort order.
|
Available values:
| Name | Description |
|---|---|
| None |
No sorting is applied to a column.
| | Ascending |
Sorts the column in ascending order.
| | Descending |
Sorts the columns in descending order.
|
To sort data against a column, specify its SortOrder property:
<dxg:GridColumn FieldName="City" SortOrder="Descending"/>
<dxg:GridColumn FieldName="Visits" SortOrder="Ascending"/>
<dxg:GridColumn FieldName="Birthday" SortOrder="None"/>
The SortOrder property does not clear the sorting applied. This property adds a new sorting condition to previous ones.
Refer to the Sorting in Code topic for more information.
The following code snippets (auto-collected from DevExpress Examples) contain references to the SortOrder property.
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.
wpf-data-grid-display-group-summaries/CS/DisplayGroupSummaries_CodeBehind/MainWindow.xaml#L15
<dxg:GridColumn FieldName="RegistrationDate" />
<dxg:GridColumn FieldName="Married" GroupIndex="0" SortOrder="Ascending" />
<dxg:GridColumn FieldName="Age" />
<dxg:GridColumn FieldName="OrderID" IsSmart="True"/>
<dxg:GridColumn FieldName="CustomerID" IsSmart="True" SortIndex="0" SortOrder="Ascending"/>
<dxg:GridColumn FieldName="OrderDate" IsSmart="True" SortIndex="1" SortOrder="Descending"/>
wpf-data-grid-getting-started-dot-net/CS/WPFDataGridGettingStartedDotNET/MainWindow.xaml#L31
<dxg:GridColumn FieldName="OrderId" IsSmart="True"/>
<dxg:GridColumn FieldName="CustomerId" IsSmart="True" SortIndex="1" SortOrder="Ascending"/>
<dxg:GridColumn FieldName="OrderDate" IsSmart="True" SortIndex="0" SortOrder="Descending"/>
wpf-data-grid-bind-to-custom-service-with-restrictions/CS/MainWindow.xaml#L16
<dxg:GridControl.Columns>
<dxg:GridColumn x:Name="hotColumn" FieldName="Hot" Visible="False" ShowInColumnChooser="False" AllowSorting="True" AllowedSortOrders="Descending" SortOrder="Descending" />
<dxg:GridColumn x:Name="weekColumn" FieldName="Week" Visible="False" ShowInColumnChooser="False" AllowSorting="True" AllowedSortOrders="Descending" />
<dxg:GridColumn FieldName="Discount"/>
<dxg:GridColumn FieldName="Status" GroupIndex="0" SortOrder="Descending"/>
<dxg:GridControl.View>
wpf-data-grid-customize-automatically-generated-columns/CS/E2019/Window1.xaml.cs#L19
column.CellTemplate = Application.Current.MainWindow.Resources["IssueNameTemplate"] as DataTemplate;
column.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
break;
wpf-data-grid-customize-automatically-generated-columns/VB/E2019/Window1.xaml.vb#L22
column.CellTemplate = TryCast(Application.Current.MainWindow.Resources("IssueNameTemplate"), DataTemplate)
column.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending
Case "IssueType"
See Also