Example #1
0
 /// <summary>
 /// Replaces the element at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index of the element to replace.</param>
 /// <param name="item">The new value for the element at the specified index. The value can be null for reference types.</param>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 ///     <paramref name="index"/> is less than zero.-or-<paramref name="index"/> is greater than <see cref="P:System.Collections.ObjectModel.Collection`1.Count"/>.</exception>
 protected override void SetItem(int index, EventBinding item)
 {
     EventBindingCollection.ValidateValue(item);
     if (item != this[index])
     {
         this[index].Source = null;
         base.SetItem(index, item);
         this[index].Source = this.SourceUIElement;
     }
 }
Example #2
0
 /// <summary>
 /// Inserts an element into the <see cref="T:System.Collections.ObjectModel.Collection`1"/> at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param>
 /// <param name="item">The object to insert. The value can be null for reference types.</param>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 ///     <paramref name="index"/> is less than zero.-or-<paramref name="index"/> is greater than <see cref="P:System.Collections.ObjectModel.Collection`1.Count"/>.</exception>
 protected override void InsertItem(int index, EventBinding item)
 {
     EventBindingCollection.ValidateValue(item);
     base.InsertItem(index, item);
     item.Source = this.SourceUIElement;
 }