Exemplo n.º 1
0
        internal override void OnColumnCollectionChanged(TreeGridColumnCollectionChangedEventArgs e)
        {
            base.OnColumnCollectionChanged(e);

            this.NeedUpdateVisualTree = true;
            this.InvalidateMeasure();
        }
Exemplo n.º 2
0
        internal override void OnColumnCollectionChanged(TreeGridColumnCollectionChangedEventArgs e)
        {
            base.OnColumnCollectionChanged(e);

            this.NeedUpdateVisualTree = true;
            this.InvalidateMeasure();
        }
Exemplo n.º 3
0
 private void OnInternalCollectionChanged()
 {
     if (this.InternalCollectionChanged != null && this._internalEventArg != null)
     {
         this.InternalCollectionChanged(this, this._internalEventArg);
         this._internalEventArg = null;
     }
 }
Exemplo n.º 4
0
        internal void UpdateItemsSourceOnColumnsChanged(TreeGridColumnCollectionChangedEventArgs e)
        {
            var multipleCopiesCollection = base.ItemsSource as MultipleCopiesCollection;

            if (multipleCopiesCollection != null)
            {
                multipleCopiesCollection.MirrorCollectionChange(e);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 在列的项变化时,同步变化对应的单元格列表 UIChildren。
        /// </summary>
        /// <param name="e"></param>
        private void OnColumnCollectionChanged(TreeGridColumnCollectionChangedEventArgs e)
        {
            TreeGridHelper.UpdateDesiredWidthListOnColumnChanged(ref this._desiredWidthList, e);

            if (this.TryConnect())
            {
                this._cellsPresenter.UpdateItemsSourceOnColumnsChanged(e);

                base.InvalidateMeasure();
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 在列的项变化时,同步变化对应的单元格列表 UIChildren。
        /// </summary>
        /// <param name="e"></param>
        internal override void OnColumnCollectionChanged(TreeGridColumnCollectionChangedEventArgs e)
        {
            base.OnColumnCollectionChanged(e);

            var internalChildren = base.UIChildren;

            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
            {
                int visualIndex = this.GetVisualIndex(e.NewStartingIndex);
                var column      = (TreeGridColumn)e.NewItems[0];
                this.CreateAndInsertHeader(column, visualIndex + 1);
                break;
            }

            case NotifyCollectionChangedAction.Remove:
                this.RemoveHeader(null, this.GetVisualIndex(e.OldStartingIndex));
                break;

            case NotifyCollectionChangedAction.Replace:
            {
                int visualIndex = this.GetVisualIndex(e.OldStartingIndex);
                this.RemoveHeader(null, visualIndex);
                var column = (TreeGridColumn)e.NewItems[0];
                this.CreateAndInsertHeader(column, visualIndex);
                break;
            }

            case NotifyCollectionChangedAction.Move:
            {
                int visualIndex2 = this.GetVisualIndex(e.OldStartingIndex);
                int visualIndex3 = this.GetVisualIndex(e.NewStartingIndex);
                var element      = (TreeGridColumnHeader)internalChildren[visualIndex2];
                internalChildren.RemoveAt(visualIndex2);
                internalChildren.Insert(visualIndex3, element);
                break;
            }

            case NotifyCollectionChangedAction.Reset:
            {
                int count = e.ClearedColumns.Count;
                for (int i = 0; i < count; i++)
                {
                    this.RemoveHeader(null, 1);
                }
                break;
            }
            }
            this.BuildHeaderLinks();
            this._isColumnChangedOrCreated = true;
        }
Exemplo n.º 7
0
 /// <summary>
 /// 当前 Columns 集合发生变更时,执行此回调。
 /// </summary>
 /// <param name="e"></param>
 internal virtual void OnColumnCollectionChanged(TreeGridColumnCollectionChangedEventArgs e)
 {
     TreeGridHelper.UpdateDesiredWidthListOnColumnChanged(ref this._desiredWidthList, e);
 }
Exemplo n.º 8
0
 internal void UpdateItemsSourceOnColumnsChanged(TreeGridColumnCollectionChangedEventArgs e)
 {
     var multipleCopiesCollection = base.ItemsSource as MultipleCopiesCollection;
     if (multipleCopiesCollection != null)
     {
         multipleCopiesCollection.MirrorCollectionChange(e);
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// 当前 Columns 集合发生变更时,执行此回调。
 /// </summary>
 /// <param name="e"></param>
 internal virtual void OnColumnCollectionChanged(TreeGridColumnCollectionChangedEventArgs e)
 {
     TreeGridHelper.UpdateDesiredWidthListOnColumnChanged(ref this._desiredWidthList, e);
 }
Exemplo n.º 10
0
 /// <summary>
 /// 保证 desiredList 与 columns 长度一致。
 /// </summary>
 internal static void UpdateDesiredWidthListOnColumnChanged(ref List<double> desiredList, TreeGridColumnCollectionChangedEventArgs e)
 {
     if (desiredList != null)
     {
         if (e.Action == NotifyCollectionChangedAction.Remove || e.Action == NotifyCollectionChangedAction.Replace)
         {
             if (desiredList.Count > e.StableIndex)
             {
                 desiredList.RemoveAt(e.StableIndex);
                 return;
             }
         }
         else
         {
             if (e.Action == NotifyCollectionChangedAction.Reset)
             {
                 desiredList = null;
             }
         }
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// 在列的项变化时,同步变化对应的单元格列表 UIChildren。
        /// </summary>
        /// <param name="e"></param>
        private void OnColumnCollectionChanged(TreeGridColumnCollectionChangedEventArgs e)
        {
            TreeGridHelper.UpdateDesiredWidthListOnColumnChanged(ref this._desiredWidthList, e);

            if (this.TryConnect())
            {
                this._cellsPresenter.UpdateItemsSourceOnColumnsChanged(e);

                base.InvalidateMeasure();
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 在列的项变化时,同步变化对应的单元格列表 UIChildren。
        /// </summary>
        /// <param name="e"></param>
        internal override void OnColumnCollectionChanged(TreeGridColumnCollectionChangedEventArgs e)
        {
            base.OnColumnCollectionChanged(e);

            var internalChildren = base.UIChildren;
            switch (e.Action)
            {
                case NotifyCollectionChangedAction.Add:
                    {
                        int visualIndex = this.GetVisualIndex(e.NewStartingIndex);
                        var column = (TreeGridColumn)e.NewItems[0];
                        this.CreateAndInsertHeader(column, visualIndex + 1);
                        break;
                    }
                case NotifyCollectionChangedAction.Remove:
                    this.RemoveHeader(null, this.GetVisualIndex(e.OldStartingIndex));
                    break;
                case NotifyCollectionChangedAction.Replace:
                    {
                        int visualIndex = this.GetVisualIndex(e.OldStartingIndex);
                        this.RemoveHeader(null, visualIndex);
                        var column = (TreeGridColumn)e.NewItems[0];
                        this.CreateAndInsertHeader(column, visualIndex);
                        break;
                    }
                case NotifyCollectionChangedAction.Move:
                    {
                        int visualIndex2 = this.GetVisualIndex(e.OldStartingIndex);
                        int visualIndex3 = this.GetVisualIndex(e.NewStartingIndex);
                        var element = (TreeGridColumnHeader)internalChildren[visualIndex2];
                        internalChildren.RemoveAt(visualIndex2);
                        internalChildren.Insert(visualIndex3, element);
                        break;
                    }
                case NotifyCollectionChangedAction.Reset:
                    {
                        int count = e.ClearedColumns.Count;
                        for (int i = 0; i < count; i++)
                        {
                            this.RemoveHeader(null, 1);
                        }
                        break;
                    }
            }
            this.BuildHeaderLinks();
            this._isColumnChangedOrCreated = true;
        }
Exemplo n.º 13
0
 /// <summary>
 /// 保证 desiredList 与 columns 长度一致。
 /// </summary>
 internal static void UpdateDesiredWidthListOnColumnChanged(ref List <double> desiredList, TreeGridColumnCollectionChangedEventArgs e)
 {
     if (desiredList != null)
     {
         if (e.Action == NotifyCollectionChangedAction.Remove || e.Action == NotifyCollectionChangedAction.Replace)
         {
             if (desiredList.Count > e.StableIndex)
             {
                 desiredList.RemoveAt(e.StableIndex);
                 return;
             }
         }
         else
         {
             if (e.Action == NotifyCollectionChangedAction.Reset)
             {
                 desiredList = null;
             }
         }
     }
 }