Udostępnij za pośrednictwem


NotifyCollectionChangedEventArgs.OldItems Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the item affected by a Replace or Remove action.

Namespace:  System.Collections.Specialized
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public ReadOnly Property OldItems As IList
public IList OldItems { get; }

Property Value

Type: System.Collections.IList
The list of items affected by a Replace or Remove action.

Remarks

In the existing Silverlight 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 Silverlight implementation you can generally assume that the IList only contains one item. To get that item you could use the C# shorthand of collectionChangedEventArgs.OldItems[0].

OldItems will contain the following depending on the Action being reported in the event data:

Action

Add contains:

Add

nulla null reference (Nothing in Visual Basic).

Remove

The removed item.

Replace

The previous (replaced) item.

Reset

nulla null reference (Nothing in Visual Basic).

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.