Skip to content

Commit

Permalink
fix ArgumentOutOfRangeException when using ToNotifyCollectionChanged …
Browse files Browse the repository at this point in the history
…with ObservableDictionary #70
  • Loading branch information
neuecc committed Sep 9, 2024
1 parent efec73f commit b0bc7c2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ObservableCollections/SynchronizedViewList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,14 @@ private void Parent_ViewChanged(in SynchronizedViewChangedEventArgs<T, TView> e)
case NotifyCollectionChangedAction.Add: // Add or Insert
if (e.IsSingleItem)
{
listView.Insert(e.NewStartingIndex, e.NewItem.View);
if (e.NewStartingIndex == -1)
{
listView.Add(e.NewItem.View);
}
else
{
listView.Insert(e.NewStartingIndex, e.NewItem.View);
}
}
else
{
Expand Down

0 comments on commit b0bc7c2

Please sign in to comment.