Пример #1
0
        private TreeGridColumnCollectionChangedEventArgs InsertPreprocess(int index, TreeGridColumn column)
        {
            int count = this._stableColumns.Count;

            if (index < 0 || index > count)
            {
                throw new ArgumentOutOfRangeException("index");
            }
            if (column == null)
            {
                throw new ArgumentNullException("column");
            }
            if (column.StableIndex >= 0)
            {
                throw new InvalidOperationException("NotAllowShareColumnToTwoColumnCollection");
            }

            column.StableIndex = count;
            this._stableColumns.Add(column);
            this._stableIndices.Insert(index, column.StableIndex);

            InheritanceContextHelper.ProvideContextForObject(this._owner, column);

            column.PropertyChanged += this.ColumnPropertyChanged;

            return(new TreeGridColumnCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, column, index, count));
        }
Пример #2
0
 private void HookContext(DependencyObject oldOwner, DependencyObject newOwner)
 {
     if (newOwner != null)
     {
         foreach (var column in this._stableColumns)
         {
             InheritanceContextHelper.ProvideContextForObject(newOwner, column);
         }
     }
     else
     {
         foreach (var column in this._stableColumns)
         {
             InheritanceContextHelper.RemoveContextFromObject(oldOwner, column);
         }
     }
 }
Пример #3
0
        private TreeGridColumnCollectionChangedEventArgs RemoveAtPreprocess(int index)
        {
            this.VerifyIndexInRange(index, "index");

            int actualIndex = this._stableIndices[index];
            var column      = this._stableColumns[actualIndex];

            column.ResetPrivateData();
            column.PropertyChanged -= this.ColumnPropertyChanged;

            this._stableColumns.RemoveAt(actualIndex);

            this.UpdateIndicesOnRemoved(actualIndex, index);

            InheritanceContextHelper.RemoveContextFromObject(this._owner, column);

            return(new TreeGridColumnCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, column, index, actualIndex));
        }
Пример #4
0
        private TreeGridColumnCollectionChangedEventArgs ClearPreprocess()
        {
            var array = new TreeGridColumn[base.Count];

            if (base.Count > 0)
            {
                base.CopyTo(array, 0);
            }

            foreach (var column in this._stableColumns)
            {
                column.ResetPrivateData();
                column.PropertyChanged -= this.ColumnPropertyChanged;
                InheritanceContextHelper.RemoveContextFromObject(this._owner, column);
            }

            this._stableColumns.Clear();
            this._stableIndices.Clear();

            return(new TreeGridColumnCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, array));
        }