Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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

C#
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