/// <summary>
        /// 在列的属性变化时,尝试重新绘制界面
        /// </summary>
        /// <param name="column"></param>
        /// <param name="propertyName"></param>
        internal override void OnColumnPropertyChanged(TreeGridColumn column, string propertyName)
        {
            base.OnColumnPropertyChanged(column, propertyName);

            if (column.StableIndex >= 0)
            {
                var header = this.FindHeaderByColumn(column);
                if (header != null)
                {
                    if (TreeGridColumn.HeaderProperty.Name == propertyName)
                    {
                        if (!header.IsInternalGenerated || column.Header is TreeGridColumnHeader)
                        {
                            int index = base.UIChildren.IndexOf(header);
                            this.RemoveHeader(header, -1);
                            this.CreateAndInsertHeader(column, index);
                            this.BuildHeaderLinks();
                            return;
                        }
                        this.UpdateHeaderContent(header);
                    }
                    else
                    {
                        var columnDPFromName = TreeGridHeaderRowPresenter.GetColumnDPFromName(propertyName);
                        if (columnDPFromName != null)
                        {
                            this.UpdateHeaderProperty(header, columnDPFromName);
                        }
                    }
                }
            }
        }
        private static ItemsControl FindItemsControlThroughTemplatedParent(TreeGridHeaderRowPresenter presenter)
        {
            var          frameworkElement = presenter.TemplatedParent as FrameworkElement;
            ItemsControl itemsControl     = null;

            while (frameworkElement != null)
            {
                itemsControl = (frameworkElement as ItemsControl);
                if (itemsControl != null)
                {
                    break;
                }
                frameworkElement = (frameworkElement.TemplatedParent as FrameworkElement);
            }
            return(itemsControl);
        }
        private void UpdateAllHeaders(DependencyProperty dp)
        {
            DependencyProperty gvDP;
            DependencyProperty columnDP;
            DependencyProperty targetDP;

            TreeGridHeaderRowPresenter.GetMatchingDPs(dp, out gvDP, out columnDP, out targetDP);
            int num;
            int num2;

            this.GetIndexRange(dp, out num, out num2);
            var internalChildren = base.UIChildren;

            for (int i = num; i <= num2; i++)
            {
                var gridViewColumnHeader = internalChildren[i] as TreeGridColumnHeader;
                if (gridViewColumnHeader != null)
                {
                    this.UpdateHeaderProperty(gridViewColumnHeader, targetDP, columnDP, gvDP);
                }
            }
        }
 private static ItemsControl FindItemsControlThroughTemplatedParent(TreeGridHeaderRowPresenter presenter)
 {
     var frameworkElement = presenter.TemplatedParent as FrameworkElement;
     ItemsControl itemsControl = null;
     while (frameworkElement != null)
     {
         itemsControl = (frameworkElement as ItemsControl);
         if (itemsControl != null)
         {
             break;
         }
         frameworkElement = (frameworkElement.TemplatedParent as FrameworkElement);
     }
     return itemsControl;
 }