Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3442,7 +3442,29 @@ private void ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
RefreshOrDefer();
return;
}


// process move action and fire notification
if (args.OldItems != null && args.Action == NotifyCollectionChangedAction.Move)
{
var targetList = UsesLocalArray ? _internalList : SourceList;

for (int i = 0; i < args.OldItems.Count; i++)
{
var item = args.OldItems[i];

int oldIndex = targetList.IndexOf(item);
if (oldIndex >= 0)
targetList.RemoveAt(oldIndex);

int newIndex = Math.Min(args.NewStartingIndex + i, targetList.Count);

targetList.Insert(newIndex, item);

OnCollectionChanged(new NotifyCollectionChangedEventArgs(
NotifyCollectionChangedAction.Move, item, newIndex, oldIndex));
}
}

// fire notifications for removes
if (args.OldItems != null &&
(args.Action == NotifyCollectionChangedAction.Remove ||
Expand Down