Skip to main content
A newer version of this page is available. .

GridColumn.SortIndex Property

Gets or sets the column’s position among sorted columns. This is a bindable property.

Namespace: DevExpress.Maui.DataGrid

Assembly: DevExpress.Maui.DataGrid.dll

NuGet Package: DevExpress.Maui.DataGrid

Declaration

public int SortIndex { get; set; }

Property Value

Type Description
Int32

The zero-based column’s index among sorted columns. -1 if data is not sorted by this column.

Remarks

The grid allows data sorting by multiple columns if the DataGridView.SortMode property is set to GridSortMode.Multiple. Set the GridColumn.SortOrder property for each column to be sorted and specify their SortIndex to set the sort sequence.

Example

The following example sorts the Employee and Birth Date column data in ascending order:

<dxg:DataGridView SortMode="Multiple" ...>
    <dxg:DataGridView.Columns>
        <dxg:TemplateColumn FieldName="Name" 
                            x:Name="EmployeeNameColumn"
                            Caption="Employee" 
                            SortIndex="0" 
                            SortOrder="Ascending" 
                            SortMode="DisplayText">
            <!--...-->
        </dxg:TemplateColumn>
        <dxg:DateColumn FieldName="BirthDate" 
                        x:Name="BirthDateColumn" 
                        SortIndex="1" 
                        SortOrder="Ascending" 
                        SortMode="Value"/>
    </dxg:DataGridView.Columns>
</dxg:DataGridView>
See Also