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 @@ -1681,8 +1681,6 @@ protected override void ProcessCollectionChanged(NotifyCollectionChangedEventArg
if (args == null)
throw new ArgumentNullException("args");

ValidateCollectionChangedEventArgs(args);

// adding or replacing an item can change CanAddNew, by providing a
// non-null representative
if (!_isItemConstructorValid)
Expand Down Expand Up @@ -2517,42 +2515,6 @@ private IList SourceList
//------------------------------------------------------

#region Private Methods

private void ValidateCollectionChangedEventArgs(NotifyCollectionChangedEventArgs e)
{
switch (e.Action)
{
case NotifyCollectionChangedAction.Add:
if (e.NewItems.Count != 1)
throw new NotSupportedException(SR.Get(SRID.RangeActionsNotSupported));
break;

case NotifyCollectionChangedAction.Remove:
if (e.OldItems.Count != 1)
throw new NotSupportedException(SR.Get(SRID.RangeActionsNotSupported));
break;

case NotifyCollectionChangedAction.Replace:
if (e.NewItems.Count != 1 || e.OldItems.Count != 1)
throw new NotSupportedException(SR.Get(SRID.RangeActionsNotSupported));
break;

case NotifyCollectionChangedAction.Move:
if (e.NewItems.Count != 1)
throw new NotSupportedException(SR.Get(SRID.RangeActionsNotSupported));
if (e.NewStartingIndex < 0)
throw new InvalidOperationException(SR.Get(SRID.CannotMoveToUnknownPosition));
break;

case NotifyCollectionChangedAction.Reset:
break;

default:
throw new NotSupportedException(SR.Get(SRID.UnexpectedCollectionChangeAction, e.Action));
}
}


/// <summary>
/// Create, filter and sort the local index array.
/// called from Refresh(), override in derived classes as needed.
Expand Down