Users can sort by clicking a column header when both of these allow it:
TreeDataGrid.CanUserSortColumnsCanUserSortColumn<TreeDataGridTextColumn Header="Name"
Binding="{Binding Name}"
CanUserSortColumn="False"/>
The fluent API uses Comparison<object?> delegates for custom sorting:
source.WithTextColumn("Name", x => x.Name, o =>
{
o.CompareAscending = (a, b) =>
string.Compare(((Person?)a)?.Name, ((Person?)b)?.Name, StringComparison.CurrentCulture);
});
Both source types expose ClearSort:
Source.ClearSort();