mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-04-26 01:42:59 -04:00
Fix error while removing filter on a sorted binding list
This commit is contained in:
@@ -120,6 +120,8 @@ namespace LibationWinForms
|
||||
|
||||
int visibleCount = Items.Count;
|
||||
|
||||
SuspendSorting = true;
|
||||
|
||||
foreach (var item in FilterRemoved.ToList())
|
||||
{
|
||||
if (item.Parent is null || item.Parent.Liberate.Expanded)
|
||||
@@ -129,6 +131,8 @@ namespace LibationWinForms
|
||||
}
|
||||
}
|
||||
|
||||
SuspendSorting = false;
|
||||
|
||||
if (IsSortedCore)
|
||||
Sort();
|
||||
else
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace LibationWinForms
|
||||
public SortableBindingList1() : base(new List<T>()) { }
|
||||
public SortableBindingList1(IEnumerable<T> enumeration) : base(new List<T>(enumeration)) { }
|
||||
|
||||
protected bool SuspendSorting { get; set; }
|
||||
protected MemberComparer<T> Comparer { get; } = new();
|
||||
protected override bool SupportsSortingCore => true;
|
||||
protected override bool SupportsSearchingCore => true;
|
||||
@@ -60,7 +61,7 @@ namespace LibationWinForms
|
||||
|
||||
protected override void OnListChanged(ListChangedEventArgs e)
|
||||
{
|
||||
if (isSorted &&
|
||||
if (isSorted && !SuspendSorting &&
|
||||
((e.ListChangedType == ListChangedType.ItemChanged && e.PropertyDescriptor == SortPropertyCore) ||
|
||||
e.ListChangedType == ListChangedType.ItemAdded))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user