Further sorting and remove books refinements

This commit is contained in:
Michael Bucari-Tovo 2022-07-14 21:14:40 -06:00
parent efd6156fa8
commit 7b7e1d8574
9 changed files with 89 additions and 46 deletions

View file

@ -13,7 +13,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
/// sorted by series index, ascending. Stable sorting is achieved by comparing the GridEntry.ListIndex
/// properties when 2 items compare equal.
/// </summary>
internal class RowComparer : IComparer
internal class RowComparer : IComparer, IComparer<GridEntry2>
{
private static readonly PropertyInfo HeaderCellPi = typeof(DataGridColumn).GetProperty("HeaderCell", BindingFlags.NonPublic | BindingFlags.Instance);
private static readonly PropertyInfo CurrentSortingStatePi = typeof(DataGridColumnHeader).GetProperty("CurrentSortingState", BindingFlags.NonPublic | BindingFlags.Instance);
@ -81,7 +81,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
return geA.SeriesIndex.CompareTo(geB.SeriesIndex) * (SortDirection is ListSortDirection.Ascending ? 1 : -1);
//a and b are children of different series.
return Compare(parentA, parentB);
return InternalCompare(parentA, parentB);
}
//Avalonia doesn't expose the column's CurrentSortingState, so we must get it through reflection
@ -102,5 +102,10 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
else
return compareResult;
}
public int Compare(GridEntry2 x, GridEntry2 y)
{
return Compare((object)x, y);
}
}
}