Skip to content

Commit

Permalink
Bugfix: BindingListCollectionView item replace issue (dotnet#1314)
Browse files Browse the repository at this point in the history
  • Loading branch information
koszeggy committed Apr 23, 2020
1 parent f226a72 commit 7b6a725
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2009,6 +2009,18 @@ private void OnListChanged(object sender, ListChangedEventArgs args)
break;

case ListChangedType.ItemChanged:
// if there is no PropertyDescriptor, then ItemChanged refers to a Replace event
// (IBindingList indexer set) and not a property change of an item
if (args.PropertyDescriptor == null)
{
item = InternalList[index];
var oldItem = _cachedList[index];
_cachedList[index] = item;
forwardedArgs = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, item, oldItem, index);
break;
}

// here ItemChange refers to a property change
if (!_itemsRaisePropertyChanged.HasValue)
{
// check whether individual items raise PropertyChanged events
Expand Down

0 comments on commit 7b6a725

Please sign in to comment.