diff --git a/src/Avalonia.Controls.DataGrid/DataGridColumn.cs b/src/Avalonia.Controls.DataGrid/DataGridColumn.cs
index 4ab2869138..07adac597f 100644
--- a/src/Avalonia.Controls.DataGrid/DataGridColumn.cs
+++ b/src/Avalonia.Controls.DataGrid/DataGridColumn.cs
@@ -653,6 +653,26 @@ namespace Avalonia.Controls
return null;
}
+ ///
+ /// Switches the current state of sort direction
+ ///
+ /// Clear the current sort direction instead
+ public void PerformSort(bool clear)
+ {
+ //InvokeProcessSort is already validating if sorting is possible
+ _headerCell?.InvokeProcessSort(clear ? Input.KeyModifiers.Control : Input.KeyModifiers.None);
+ }
+
+ ///
+ /// Changes the sort direction of this column
+ ///
+ /// New sort direction
+ public void PerformSort(ListSortDirection direction)
+ {
+ //InvokeProcessSort is already validating if sorting is possible
+ _headerCell?.InvokeProcessSort(Input.KeyModifiers.None, direction);
+ }
+
///
/// When overridden in a derived class, causes the column cell being edited to revert to the unedited value.
///