private void TrackCollection() { var items = Items as ObservableCollection <TItem>; if (items != null) { var collection = items; _itemsChangedHandler = WeakEvent.RegisterEvent <ObservableCollectionViewBase <TItem>, NotifyCollectionChangedEventHandler, NotifyCollectionChangedEventArgs>( this, h => collection.CollectionChanged += h, h => collection.CollectionChanged -= h, h => (o, e) => h(o, e), (subscriber, s, e) => subscriber.OnOriginalCollectionChanged(s, e)); } }
private void RegisterEvent(INotifyPropertyChanged item) { if (_events.ContainsKey(item)) { return; } var handler = WeakEvent.RegisterEvent <ObservableCollectionViewBase <TItem>, PropertyChangedEventHandler, PropertyChangedEventArgs>( this, h => item.PropertyChanged += h, h => item.PropertyChanged -= h, h => (o, e) => h(o, e), (subscriber, s, e) => subscriber.Refresh()); _events.Add(item, handler); }