Xceed DataGrid for WPF v7.3 Documentation
SortDirection Property (ColumnBase)
Example 


Xceed.Wpf.DataGrid Assembly > Xceed.Wpf.DataGrid Namespace > ColumnBase Class : SortDirection Property
Gets a value indicating the direction in which the values contained in the column are sorted.
Syntax
'Declaration
 
Public ReadOnly Property SortDirection As SortDirection
 
'Usage
 
Dim instance As ColumnBase
Dim value As SortDirection
 
value = instance.SortDirection

Property Value

A SortDirection value indicating the direction in which the values contained in the column are sorted. By default, SortDirection.None.

Member Description
None The column is not sorted.
Ascending The column's values are sorted in an ascending direction.
Descending The column's values are sorted in a descending direction.

Example
All examples in this topic assume that the grid is bound to the Orders table of the Northwind database, unless stated otherwise.
The following example demonstrates how to sort the data items in ascending order according to the values of the ShipCountry column.The following example demonstrates how to provide a custom sort comparer that sorts addresses. The AddressComparer class (provided below) will first sort addresses which begin with numeric values by street name and then civic number. Address that do not have a civic number will be sorted alphabetically.The following code provides the implementation of the AddressComparer class.The following code provides the implementation of the AddressComparer class.
<Grid xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase" 
      xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"> 
  <Grid.Resources> 
    <xcdg:DataGridCollectionViewSource x:Key="cvs_orders" 
                                     Source="{Binding Source={x:Static Application.Current}, 
                                                       Path=Orders}"> 
 
     <xcdg:DataGridCollectionViewSource.SortDescriptions> 
       <scm:SortDescription PropertyName="ShipCountry" Direction="Ascending"/> 
     </xcdg:DataGridCollectionViewSource.SortDescriptions> 
    </xcdg:DataGridCollectionViewSource>           
  </Grid.Resources> 
 
  <xcdg:DataGridControl x:Name="OrdersGrid" 
                        ItemsSource="{Binding Source={StaticResource cvs_orders}}"> 
    <xcdg:DataGridControl.Columns> 
      <xcdg:Column FieldName="ShipCountry" VisiblePosition="0"/> 
    </xcdg:DataGridControl.Columns> 
  </xcdg:DataGridControl> 
</Grid>
Requirements

Target Platforms: Windows 11, Windows, 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ColumnBase Class
ColumnBase Members