private void _wrappedCollection_CollectionChanged(object sender, Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (_notificationsLockCount == 0) { CollectionChanged(this, e); } }
void collection_CollectionChanged(object sender, Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (!IsTrackedNodeAlive) { return; } this.UpdateChildren(e); }
void InternalChildren_CollectionChanged(object sender, Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (e.Action == Collections.Specialized.NotifyCollectionChangedAction.Remove) { foreach (TreeViewItemViewModel item in e.OldItems) { this.ChildrenValueCache.Remove(item.GetValue()); } } }
protected override void OnItemsChanged(Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (e.Action == Collections.Specialized.NotifyCollectionChangedAction.Remove) { // Don't select itself when its child items got removed. (Default action of base.OnItemsChanged) // The selection should be managed by designer surface. return; } base.OnItemsChanged(e); }
public void Handler(object sender, Collections.Specialized.NotifyCollectionChangedEventArgs e) { var target = _targetReference.Target; if (target == null) { return; } var callback = (Action <object, Collections.Specialized.NotifyCollectionChangedEventArgs>)_method.CreateDelegate(typeof(Action <object, Collections.Specialized.NotifyCollectionChangedEventArgs>), target); callback?.Invoke(sender, e); }
protected override void UpdateOnAdd(Collections.Specialized.NotifyCollectionChangedEventArgs e) { base.UpdateOnAdd(e); var indexInSource = e.NewStartingIndex; foreach (var item in e.NewItems.OfType <T>()) { UpdateOnInsert(_source.Rewind(e), indexInSource, item); indexInSource++; } }
protected override void UpdateOnMove(Collections.Specialized.NotifyCollectionChangedEventArgs e) { base.UpdateOnMove(e); for (int indexInEvent = 0; indexInEvent < e.NewItems.Count; indexInEvent++) { int newIndexInSource = e.NewStartingIndex + indexInEvent; int oldIndexInSource = e.OldStartingIndex + indexInEvent; var item = (T)e.OldItems[indexInEvent]; UpdateOnMove(_source.Rewind(e), newIndexInSource, oldIndexInSource, item); } }
protected override void UpdateOnReplace(Collections.Specialized.NotifyCollectionChangedEventArgs e) { base.UpdateOnReplace(e); for (int indexInEvent = 0; indexInEvent < e.NewItems.Count; indexInEvent++) { int indexInSource = e.NewStartingIndex + indexInEvent; var oldItem = (T)e.OldItems[indexInEvent]; var newItem = (T)e.NewItems[indexInEvent]; if (!_comparer.Equals(oldItem, newItem)) { UpdateOnReplace(_source.Rewind(e), indexInSource, newItem, oldItem); } } }
private void ControlsCollection_CollectionChanged(object sender, Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) { foreach (var ctrl in e.NewItems.Cast <Control>()) { ctrl.Parent = Parent; } } else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove) { foreach (var ctrl in e.OldItems.Cast <Control>()) { ctrl.Parent = null; } } }
protected override void UpdateOnReset(Collections.Specialized.NotifyCollectionChangedEventArgs e) { base.UpdateOnReset(e); Clear(); }
private void Items_CollectionChanged(object sender, Collections.Specialized.NotifyCollectionChangedEventArgs e) { ItemsChanged(e).Wait(); }