/// <summary> /// Adds a weak event listener for a CollectionChanged event. /// </summary> /// <param name="source">The source of the event.</param> /// <param name="handler">The event handler.</param> /// <exception cref="T:System.ArgumentNullException">source must not be <c>null</c>.</exception> /// <exception cref="T:System.ArgumentNullException">handler must not be <c>null</c>.</exception> protected void AddWeakEventListener(INotifyCollectionChanged source, NotifyCollectionChangedEventHandler handler) { if (source == null) { throw new ArgumentNullException("source"); } if (handler == null) { throw new ArgumentNullException("handler"); } var changedEventListener = new CollectionChangedEventListener(source, handler); collectionChangedListeners.Add(changedEventListener); CollectionChangedEventManager.AddListener(source, changedEventListener); }