コード例 #1
0
 void AddWithNotification(WritableKeyValuePair <TKey, TValue> keyvaluepair)
 {
     dictionary.Add(keyvaluepair);
     CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add,
                                                                  keyvaluepair));
     PropertyChanged(this, new PropertyChangedEventArgs("Count"));
 }
コード例 #2
0
        void UpdateWithNotification(WritableKeyValuePair <TKey, TValue> newkeyvaluepair)
        {
            if (this.ContainsKey(newkeyvaluepair.Key))
            {
                var index    = IndexOf(newkeyvaluepair.Key);
                var oldvalue = dictionary[index];
                dictionary[index] = newkeyvaluepair;

                CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace,
                                                                             newkeyvaluepair, oldvalue, index));
            }
            else
            {
                AddWithNotification(newkeyvaluepair);
            }
        }
コード例 #3
0
 public void Insert(int index, WritableKeyValuePair <TKey, TValue> item)
 {
     throw new NotImplementedException();
 }
コード例 #4
0
 public int IndexOf(WritableKeyValuePair <TKey, TValue> item)
 {
     return(dictionary.IndexOf(item));
 }
コード例 #5
0
 bool ICollection <WritableKeyValuePair <TKey, TValue> > .Remove(WritableKeyValuePair <TKey, TValue> item)
 {
     return(RemoveWithNotification(item.Key));
 }
コード例 #6
0
 bool ICollection <WritableKeyValuePair <TKey, TValue> > .Contains(WritableKeyValuePair <TKey, TValue> item)
 {
     return(((ICollection <WritableKeyValuePair <TKey, TValue> >)dictionary).Contains(item));
 }
コード例 #7
0
 void ICollection <WritableKeyValuePair <TKey, TValue> > .Add(WritableKeyValuePair <TKey, TValue> item)
 {
     AddWithNotification(item);
 }