From 2248d7b24eada32f8bec49853184f4c7b8562b3e Mon Sep 17 00:00:00 2001 From: Mbucari <37587114+Mbucari@users.noreply.github.com> Date: Sun, 2 Apr 2023 21:28:55 -0600 Subject: [PATCH] Sort episodes by column beneath their parents --- Source/LibationAvalonia/ViewModels/RowComparer.cs | 4 ++-- Source/LibationWinForms/GridView/GridEntryBindingList.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/LibationAvalonia/ViewModels/RowComparer.cs b/Source/LibationAvalonia/ViewModels/RowComparer.cs index b20dc5de..743a610f 100644 --- a/Source/LibationAvalonia/ViewModels/RowComparer.cs +++ b/Source/LibationAvalonia/ViewModels/RowComparer.cs @@ -70,9 +70,9 @@ namespace LibationAvalonia.ViewModels return InternalCompare(parentA, geB); } - //both are children of the same series, always present in order of series index, ascending + //both are children of the same series if (parentA == parentB) - return geA.SeriesIndex.CompareTo(geB.SeriesIndex) * (sortDirection is ListSortDirection.Ascending ? 1 : -1); + return InternalCompare(geA, geB); //a and b are children of different series. return InternalCompare(parentA, parentB); diff --git a/Source/LibationWinForms/GridView/GridEntryBindingList.cs b/Source/LibationWinForms/GridView/GridEntryBindingList.cs index 9203ad53..b5b10c5e 100644 --- a/Source/LibationWinForms/GridView/GridEntryBindingList.cs +++ b/Source/LibationWinForms/GridView/GridEntryBindingList.cs @@ -201,8 +201,8 @@ namespace LibationWinForms.GridView { var pIndex = itemsList.IndexOf(parent); - //children should always be sorted by series index. - foreach (var c in children.Where(c => c.Parent == parent).OrderBy(c => c.SeriesIndex)) + //children are sorted beneath their series parent + foreach (var c in children.Where(c => c.Parent == parent).OrderBy(c => c, Comparer)) itemsList.Insert(++pIndex, c); } }