protected override void CollectionWasChanged(KeyItemChange change, int position)
        {
            if (collectionChanged != null)
            {
                switch (change)
                {
                case KeyItemChange.Add:
                    OnPropertyChanged("Item[]");
                    OnPropertyChanged("Count");
                    OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, this[position], position));
                    break;

                case KeyItemChange.Remove:
                    OnPropertyChanged("Item[]");
                    OnPropertyChanged("Count");
                    OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, null, position));
                    break;

                case KeyItemChange.Changed:
                    OnPropertyChanged("Item[]");
                    OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, this[position], null, position));
                    break;

                case KeyItemChange.OrderChanged:
                    OnPropertyChanged("Item[]");
                    OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Move, (IList)this.Values, 0));
                    break;
                }
            }
        }
Пример #2
0
 protected override void CollectionWasChanged(KeyItemChange change, int position)
 {
     Modified = true;
 }
Пример #3
0
 /// <summary>
 /// Called if Collection was the changed.
 /// </summary>
 /// <param name="change">The change.</param>
 /// <param name="position">The position.</param>
 protected virtual void CollectionWasChanged(KeyItemChange change, int position)
 {
 }