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

DataGridView.ClearSorting() Method

In This Article

Clears the sorting applied to the grid.

Namespace: DevExpress.Maui.DataGrid

Assembly: DevExpress.Maui.DataGrid.dll

NuGet Package: DevExpress.Maui.DataGrid

#Declaration

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