Browse Source

Fixed DataGrid not properly removing multiple items on collection changed.

pull/9135/head
John Boyer 4 years ago
committed by ghasttear1
parent
commit
1a9ed2052a
  1. 12
      src/Avalonia.Controls.DataGrid/Collections/DataGridCollectionView.cs

12
src/Avalonia.Controls.DataGrid/Collections/DataGridCollectionView.cs

@ -3413,13 +3413,15 @@ namespace Avalonia.Collections
return;
}
object removedItem = args.OldItems?[0];
// fire notifications for removes
if (args.Action == NotifyCollectionChangedAction.Remove ||
args.Action == NotifyCollectionChangedAction.Replace)
if (args.OldItems != null &&
(args.Action == NotifyCollectionChangedAction.Remove ||
args.Action == NotifyCollectionChangedAction.Replace))
{
ProcessRemoveEvent(removedItem, args.Action == NotifyCollectionChangedAction.Replace);
foreach (var removedItem in args.OldItems)
{
ProcessRemoveEvent(removedItem, args.Action == NotifyCollectionChangedAction.Replace);
}
}
// fire notifications for adds

Loading…
Cancel
Save