NotifyCollectionChangedEventArgs.NewItems Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets the items affected by an action.
Namespace: System.Collections.Specialized
Assembly: System (in System.dll)
Syntax
Public ReadOnly Property NewItems As IList
public IList NewItems { get; }
Property Value
Type: System.Collections..::.IList
The list of items affected by an action. The default is nullNothingnullptra null reference (Nothing in Visual Basic).
Remarks
In the existing Windows Phone implementation, INotifyCollectionChanged is always used for single item changes. Because of the NotifyCollectionChangedEventArgs constructor signatures, it is not possible to raise CollectionChanged in such a way that it reports multiple items.
The type of this property is IList for compatibility, but in the existing Windows Phone implementation you can generally assume that the IList only contains one item. To get that item you could use the C# shorthand of collectionChangedEventArgs.NewItems[0].
NewItems will contain the following depending on the Action being reported in the event data:
Action |
Add contains: |
---|---|
The newly added item. |
|
nullNothingnullptra null reference (Nothing in Visual Basic). |
|
The newly added (replacing) item. |
|
nullNothingnullptra null reference (Nothing in Visual Basic). |
Version Information
Windows Phone OS
Supported in: 8.1, 8.0, 7.1, 7.0
Platforms
Windows Phone