Skip to main content

DataGridView.ClearSorting() Method

Clears the sorting applied to the grid.

Namespace: DevExpress.Maui.DataGrid

Assembly: DevExpress.Maui.DataGrid.dll

NuGet Package: DevExpress.Maui.DataGrid

Declaration

public void ClearSorting()

Remarks

The ClearSorting method removes sorting applied to all columns. To clear sorting by a specific column, set the column’s GridColumn.SortOrder property to ColumnSortOrder.None.

The following example shows how to clear sorting when a user clicks the Clear Sorting button:

<Grid RowDefinitions="100, *">
    <Button Grid.Row="0" 
            Text="Clear Sorting" 
            Clicked="Button_Clicked"/>
    <dxg:DataGridView Grid.Row="1" 
                      x:Name="Grid" 
                      SortMode="Multiple">
        <!--...-->
    </dxg:DataGridView>
</Grid>
private void Button_Clicked(object sender, EventArgs e) {
    Grid.ClearSorting();
}
See Also