// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Collections;
namespace System.Windows.Controls.DataVisualization
{
///
/// An observable collection that cannot be reset. When clear is called
/// items are removed individually, giving listeners the chance to detect
/// each remove event and perform operations such as unhooking event
/// handlers.
///
/// The type of item in the collection.
internal class NoResetObservableCollection : ObservableCollection
{
///
/// Instantiates a new instance of the NoResetObservableCollection
/// class.
///
public NoResetObservableCollection()
{
}
///
/// Clears all items in the collection by removing them individually.
///
protected override void ClearItems()
{
IList items = new List(this);
foreach (T item in items)
{
Remove(item);
}
}
}
}