private void ListCollectionChanged <T>(DelayLoadingObservableCollection <T> target, NotifyCollectionChangedEventArgs e) where T : class { switch (e.Action) { case NotifyCollectionChangedAction.Add: target.Insert(e.NewStartingIndex, (T)e.NewItems[0]); break; case NotifyCollectionChangedAction.Move: target.Move(e.OldStartingIndex, e.NewStartingIndex); break; case NotifyCollectionChangedAction.Remove: target.RemoveAt(e.OldStartingIndex); break; case NotifyCollectionChangedAction.Reset: target.Clear(); break; case NotifyCollectionChangedAction.Replace: Debug.Assert(false); break; } }