/// <summary> /// Adds the elements of the given collection to the end of this list. If /// required, the capacity of the list is increased to twice the previous /// capacity or the new size, whichever is larger. /// </summary> /// <param name="collection">collection to append</param> public void AddRange(ICollection collection) { if (collection == null) { throw new ArgumentNullException("collection"); } if (collection.Count > 0) { if (_innerBindingList == null) { _innerBindingList = new System.Collections.Generic.List <InputBinding>(collection.Count); } IEnumerator collectionEnum = collection.GetEnumerator(); while (collectionEnum.MoveNext()) { InputBinding inputBinding = collectionEnum.Current as InputBinding; if (inputBinding != null) { _innerBindingList.Add(inputBinding); InheritanceContextHelper.ProvideContextForObject(_owner, inputBinding); } else { throw new NotSupportedException(SR.Get(SRID.CollectionOnlyAcceptsInputBindings)); } } } }
// Remove an inheritance context (this will be a FE/FCE) internal override void RemoveInheritanceContext(DependencyObject context, DependencyProperty property) { InheritanceContextHelper.RemoveInheritanceContext(context, this, ref _hasMultipleInheritanceContexts, ref _inheritanceContext); }
/// <summary> /// IList.Remove /// </summary> public bool Remove(TriggerAction value) { CheckSealed(); InheritanceContextHelper.RemoveContextFromObject(_owner, value); bool wasRemoved = _rawList.Remove(value); return(wasRemoved); }
// Token: 0x06000CD3 RID: 3283 RVA: 0x0002FB6D File Offset: 0x0002DD6D private void OnAdd(TriggerBase triggerBase) { if (this.Owner != null && this.Owner.IsInitialized) { EventTrigger.ProcessOneTrigger(this.Owner, triggerBase); } InheritanceContextHelper.ProvideContextForObject(this.Owner, triggerBase); }
/////////////////////////////////////////////////////////////////////// // Object-based implementations that can be removed once Parser // has IList<T> support for strong typing. int IList.Add(object value) { CheckSealed(); InheritanceContextHelper.ProvideContextForObject(_owner, value as DependencyObject); int index = ((IList)_rawList).Add(VerifyIsTriggerAction(value)); return(index); }
/// <summary> /// IList.RemoveAt /// </summary> public void RemoveAt(int index) { CheckSealed(); TriggerAction oldValue = _rawList[index]; InheritanceContextHelper.RemoveContextFromObject(_owner, oldValue); _rawList.RemoveAt(index); }
/// <summary>Removes all items from the collection.</summary> // Token: 0x06000C96 RID: 3222 RVA: 0x0002F3D4 File Offset: 0x0002D5D4 public void Clear() { this.CheckSealed(); for (int i = this._rawList.Count - 1; i >= 0; i--) { InheritanceContextHelper.RemoveContextFromObject(this._owner, this._rawList[i]); } this._rawList.Clear(); }
/// <summary> /// Remove /// </summary> /// <param name="inputBinding"></param> public void Remove(InputBinding inputBinding) { if (_innerBindingList != null && inputBinding != null) { if (_innerBindingList.Remove(inputBinding as InputBinding)) { InheritanceContextHelper.RemoveContextFromObject(_owner, inputBinding); } } }
// Remove an inheritance context (this will be a FE/FCE) internal override void RemoveInheritanceContext(DependencyObject context, DependencyProperty property) { InheritanceContextHelper.RemoveInheritanceContext(context, this, ref _hasMultipleInheritanceContexts, ref _inheritanceContext); // after removing a context, we don't know which property caused it _propertyForInheritanceContext = null; }
// Token: 0x06000CD4 RID: 3284 RVA: 0x0002FB9C File Offset: 0x0002DD9C private void OnRemove(TriggerBase triggerBase) { if (this.Owner != null) { if (this.Owner.IsInitialized) { EventTrigger.DisconnectOneTrigger(this.Owner, triggerBase); } InheritanceContextHelper.RemoveContextFromObject(this.Owner, triggerBase); } }
// Called by GenericCollection.tb when a trigger is added to the collection. // We use this opportunity to hook it into the tree. private void OnAdd(TriggerBase triggerBase) { // If we don't have an Owner (the Style/Template case), or the // element isn't initialized yet, we don't need to do anything if (Owner != null && Owner.IsInitialized) { EventTrigger.ProcessOneTrigger(Owner, triggerBase); } InheritanceContextHelper.ProvideContextForObject(Owner, triggerBase); }
/// <summary> /// Insert at given index /// </summary> /// <param name="index">index at which to insert the given item</param> /// <param name="inputBinding">inputBinding to insert</param> public void Insert(int index, InputBinding inputBinding) { if (inputBinding == null) { throw new NotSupportedException(SR.Get(SRID.CollectionOnlyAcceptsInputBindings)); } if (_innerBindingList != null) { _innerBindingList.Insert(index, inputBinding); InheritanceContextHelper.ProvideContextForObject(_owner, inputBinding); } }
/// <summary> /// Clears the Entire InputBindingCollection /// </summary> public void Clear() { if (_innerBindingList != null) { List <InputBinding> oldInputBindings = new List <InputBinding>(_innerBindingList); _innerBindingList.Clear(); _innerBindingList = null; foreach (InputBinding inputBinding in oldInputBindings) { InheritanceContextHelper.RemoveContextFromObject(_owner, inputBinding); } } }
// Token: 0x06000CD5 RID: 3285 RVA: 0x0002FBCC File Offset: 0x0002DDCC private void OnClear() { if (this.Owner != null) { if (this.Owner.IsInitialized) { EventTrigger.DisconnectAllTriggers(this.Owner); } for (int i = base.Count - 1; i >= 0; i--) { InheritanceContextHelper.RemoveContextFromObject(this.Owner, base[i]); } } }
// Token: 0x06004D14 RID: 19732 RVA: 0x0015B50C File Offset: 0x0015970C private GridViewColumnCollectionChangedEventArgs RemoveAtPreprocess(int index) { this.VerifyIndexInRange(index, "index"); int num = this._actualIndices[index]; GridViewColumn gridViewColumn = this._columns[num]; gridViewColumn.ResetPrivateData(); ((INotifyPropertyChanged)gridViewColumn).PropertyChanged -= this.ColumnPropertyChanged; this._columns.RemoveAt(num); this.UpdateIndexList(num, index); this.UpdateActualIndexInColumn(num); InheritanceContextHelper.RemoveContextFromObject(this._owner, gridViewColumn); return(new GridViewColumnCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, gridViewColumn, index, num)); }
/// <summary>Gets or sets the item that is at the specified index.</summary> /// <param name="index">The zero-based index of the item to get or set.</param> /// <returns>The <see cref="T:System.Windows.TriggerAction" /> object that is at the specified index.</returns> // Token: 0x17000402 RID: 1026 public TriggerAction this[int index] { get { return(this._rawList[index]); } set { this.CheckSealed(); object obj = this._rawList[index]; InheritanceContextHelper.RemoveContextFromObject(this.Owner, obj as DependencyObject); this._rawList[index] = value; } }
/// <summary> /// IList.Item /// </summary> public TriggerAction this[int index] { get { return(_rawList[index]); } set { CheckSealed(); object oldValue = _rawList[index]; InheritanceContextHelper.RemoveContextFromObject(Owner, oldValue as DependencyObject); _rawList[index] = value; } }
private GridViewColumnCollectionChangedEventArgs InsertPreprocess(int index, GridViewColumn column) { int count = _columns.Count; if (index < 0 || index > count) { throw new ArgumentOutOfRangeException("index"); } ValidateColumnForInsert(column); _columns.Add(column); column.ActualIndex = count; _actualIndices.Insert(index, count); // // NOTE: // // To prevent a useless (if not error prone) event from being fired, we need to call // {ProvideContextForObject()} before {column.PropertyChanged += ...}. // // Below is the case when a column property change event can be fired before the event // that this column was added into the collection. // // 1. add a new column to the ColumnCollection, e.g. // // <GridViewColumn CellTemplate="{DynamicResource ...}" .../> // // 2. once column is connected to the collection, DynamicResource will start loading // the template // // 3. #1 will trigger a collection change event which will be fired when this method // is accomplished. // // 4. #2 will trigger a property change event which will be fired at the middle of this // method. // // Ultimately, RowPresenter will receive both #3 and #4. But from above, #4 will come // before #3. Therefore #4 is totally useless because #3 is unknown yet. // InheritanceContextHelper.ProvideContextForObject(_owner, column); ((INotifyPropertyChanged)column).PropertyChanged += new PropertyChangedEventHandler(ColumnPropertyChanged); return(new GridViewColumnCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, column, index, count /* actual index*/)); }
/// <summary> /// RemoveAt /// </summary> /// <param name="index">index at which the item needs to be removed</param> public void RemoveAt(int index) { if (_innerBindingList != null) { InputBinding oldInputBinding = null; if (index >= 0 && index < _innerBindingList.Count) { oldInputBinding = _innerBindingList[index]; } _innerBindingList.RemoveAt(index); if (oldInputBinding != null) { InheritanceContextHelper.RemoveContextFromObject(_owner, oldInputBinding); } } }
// Token: 0x06004D17 RID: 19735 RVA: 0x0015B660 File Offset: 0x00159860 private GridViewColumnCollectionChangedEventArgs InsertPreprocess(int index, GridViewColumn column) { int count = this._columns.Count; if (index < 0 || index > count) { throw new ArgumentOutOfRangeException("index"); } this.ValidateColumnForInsert(column); this._columns.Add(column); column.ActualIndex = count; this._actualIndices.Insert(index, count); InheritanceContextHelper.ProvideContextForObject(this._owner, column); ((INotifyPropertyChanged)column).PropertyChanged += this.ColumnPropertyChanged; return(new GridViewColumnCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, column, index, count)); }
// Called by GenericCollection.tb when a trigger is removed from the collection. // We use this opportunity to pull its hooks out of the tree. private void OnRemove(TriggerBase triggerBase) { // If we don't have an Owner (the Style/Template case), // we don't need to do anything if (Owner != null) { // If the owner is initialized, we need to disconnect the trigger. if (Owner.IsInitialized) { EventTrigger.DisconnectOneTrigger(Owner, triggerBase); } // We always need to update the inheritance context InheritanceContextHelper.RemoveContextFromObject(Owner, triggerBase); } }
// Token: 0x06004D13 RID: 19731 RVA: 0x0015B460 File Offset: 0x00159660 private GridViewColumnCollectionChangedEventArgs ClearPreprocess() { GridViewColumn[] array = new GridViewColumn[base.Count]; if (base.Count > 0) { base.CopyTo(array, 0); } foreach (GridViewColumn gridViewColumn in this._columns) { gridViewColumn.ResetPrivateData(); ((INotifyPropertyChanged)gridViewColumn).PropertyChanged -= this.ColumnPropertyChanged; InheritanceContextHelper.RemoveContextFromObject(this._owner, gridViewColumn); } this._columns.Clear(); this._actualIndices.Clear(); return(new GridViewColumnCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, array)); }
/// <summary> /// Add /// </summary> /// <param name="inputBinding"></param> public int Add(InputBinding inputBinding) { if (inputBinding != null) { if (_innerBindingList == null) { _innerBindingList = new System.Collections.Generic.List <InputBinding>(1); } _innerBindingList.Add(inputBinding); InheritanceContextHelper.ProvideContextForObject(_owner, inputBinding); return(0); // ICollection.Add no longer returns the indice } else { throw new NotSupportedException(SR.Get(SRID.CollectionOnlyAcceptsInputBindings)); } }
/// <summary> /// Indexing operator /// </summary> public InputBinding this[int index] { get { // disable PreSharp warning about throwing exceptions in getter; // this is allowed in an indexed property. (First disable C# // warning about unknown warning numbers.) #pragma warning disable 1634, 1691 #pragma warning disable 6503 if (_innerBindingList != null) { return(_innerBindingList[index]); } else { throw new ArgumentOutOfRangeException("index"); } #pragma warning restore 6503 #pragma warning restore 1634, 1691 } set { if (_innerBindingList != null) { InputBinding oldInputBinding = null; if (index >= 0 && index < _innerBindingList.Count) { oldInputBinding = _innerBindingList[index]; } _innerBindingList[index] = value; if (oldInputBinding != null) { InheritanceContextHelper.RemoveContextFromObject(_owner, oldInputBinding); } InheritanceContextHelper.ProvideContextForObject(_owner, value); } else { throw new ArgumentOutOfRangeException("index"); } } }
// Receive a new inheritance context (this will be a FE/FCE) internal override void AddInheritanceContext(DependencyObject context, DependencyProperty property) { // remember which property caused the context - BindingExpression wants to know // (this must happen before calling AddInheritanceContext, so that the answer // is ready during the InheritanceContextChanged event) if (!_hasMultipleInheritanceContexts && _inheritanceContext == null) { _propertyForInheritanceContext = property; } else { _propertyForInheritanceContext = null; } InheritanceContextHelper.AddInheritanceContext(context, this, ref _hasMultipleInheritanceContexts, ref _inheritanceContext); }
// Called by GenericCollection.tb when the collection is cleared. // We use this opportunity to pull all the hooks out of the tree. private void OnClear() { // If we don't have an Owner (the Style/Template case), // we don't need to do anything if (Owner != null) { // If the owner is initialized, we need to disconnect all the trigger. if (Owner.IsInitialized) { EventTrigger.DisconnectAllTriggers(Owner); } // We always need to update the inheritance context for (int i = Count - 1; i >= 0; i--) { InheritanceContextHelper.RemoveContextFromObject(Owner, this[i]); } } }
private GridViewColumnCollectionChangedEventArgs RemoveAtPreprocess(int index) { VerifyIndexInRange(index, "index"); int actualIndex = _actualIndices[index]; GridViewColumn column = _columns[actualIndex]; column.ResetPrivateData(); ((INotifyPropertyChanged)column).PropertyChanged -= new PropertyChangedEventHandler(ColumnPropertyChanged); _columns.RemoveAt(actualIndex); UpdateIndexList(actualIndex, index); UpdateActualIndexInColumn(actualIndex); InheritanceContextHelper.RemoveContextFromObject(_owner, column); return(new GridViewColumnCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, column, index, actualIndex)); }
private GridViewColumnCollectionChangedEventArgs ClearPreprocess() { GridViewColumn[] list = new GridViewColumn[Count]; if (Count > 0) { CopyTo(list, 0); } // reset columns *before* remove foreach (GridViewColumn c in _columns) { c.ResetPrivateData(); ((INotifyPropertyChanged)c).PropertyChanged -= new PropertyChangedEventHandler(ColumnPropertyChanged); InheritanceContextHelper.RemoveContextFromObject(_owner, c); } _columns.Clear(); _actualIndices.Clear(); return(new GridViewColumnCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, list)); }
/// <summary> /// IList.Insert /// </summary> public void Insert(int index, TriggerAction value) { CheckSealed(); InheritanceContextHelper.ProvideContextForObject(_owner, value); _rawList.Insert(index, value); }
/////////////////////////////////////////////////////////////////////// // Strongly-typed implementations /// <summary> /// IList.Add /// </summary> public void Add(TriggerAction value) { CheckSealed(); InheritanceContextHelper.ProvideContextForObject(_owner, value); _rawList.Add(value); }