System.Windows.Controls.ItemsControl.IListenCollectionChanged C# (CSharp) Méthode

IListenCollectionChanged() private méthode

private IListenCollectionChanged ( object sender, NotifyCollectionChangedEventArgs e ) : void
sender object
e NotifyCollectionChangedEventArgs
Résultat void
		void IListenCollectionChanged.CollectionChanged (object sender, NotifyCollectionChangedEventArgs e)
		{
			switch (e.Action) {
			case NotifyCollectionChangedAction.Add:
				for (int i = 0; i < e.NewItems.Count; i ++)
					Items.InsertImpl (e.NewStartingIndex + i, e.NewItems[i]);
				break;
			case NotifyCollectionChangedAction.Remove:
				for (int i = 0; i < e.OldItems.Count; i ++)
					Items.RemoveAtImpl (e.OldStartingIndex);
				break;
			case NotifyCollectionChangedAction.Replace:
				for (int i = 0; i < e.NewItems.Count; i++)
					Items.SetItemImpl (e.NewStartingIndex+i, e.NewItems[i]);
				break;
			case NotifyCollectionChangedAction.Reset:
				Items.ClearImpl ();
				foreach (var v in ItemsSource)
					Items.AddImpl (v);
				break;
			}
		}