コード例 #1
0
        // Token: 0x060048D3 RID: 18643 RVA: 0x0014A864 File Offset: 0x00148A64
        public static void OnColumnWidthChanged(IProvideDataGridColumn cell, DependencyPropertyChangedEventArgs e)
        {
            UIElement      uielement = (UIElement)cell;
            DataGridColumn column    = cell.Column;
            bool           flag      = cell is DataGridColumnHeader;

            if (column != null)
            {
                DataGridLength width = column.Width;
                if (width.IsAuto || (!flag && width.IsSizeToCells) || (flag && width.IsSizeToHeader))
                {
                    DataGridLength dataGridLength = (DataGridLength)e.OldValue;
                    double         num;
                    if (dataGridLength.UnitType != width.UnitType)
                    {
                        double constraintWidth = column.GetConstraintWidth(flag);
                        if (!DoubleUtil.AreClose(uielement.DesiredSize.Width, constraintWidth))
                        {
                            uielement.InvalidateMeasure();
                            uielement.Measure(new Size(constraintWidth, double.PositiveInfinity));
                        }
                        num = uielement.DesiredSize.Width;
                    }
                    else
                    {
                        num = dataGridLength.DesiredValue;
                    }
                    if (DoubleUtil.IsNaN(width.DesiredValue) || DoubleUtil.LessThan(width.DesiredValue, num))
                    {
                        column.SetWidthInternal(new DataGridLength(width.Value, width.UnitType, num, width.DisplayValue));
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        ///     Helper method which returns the parent DataGridCellsPanel for a cell
        /// </summary>
        /// <param name="cell">The cell or header.</param>
        /// <returns>Parent panel of the given cell or header</returns>
        public static DataGridCellsPanel GetParentPanelForCell(IProvideDataGridColumn cell)
        {
            Debug.Assert((cell is DataGridCell) || (cell is DataGridColumnHeader), "provideColumn should be one of the cell or header containers.");

            UIElement element = (UIElement)cell;

            return(VisualTreeHelper.GetParent(element) as DataGridCellsPanel);
        }
コード例 #3
0
        // Token: 0x060048D6 RID: 18646 RVA: 0x0014A9C8 File Offset: 0x00148BC8
        public static double GetParentCellsPanelHorizontalOffset(IProvideDataGridColumn cell)
        {
            DataGridCellsPanel parentPanelForCell = DataGridHelper.GetParentPanelForCell(cell);

            if (parentPanelForCell != null)
            {
                return(parentPanelForCell.ComputeCellsPanelHorizontalOffset());
            }
            return(0.0);
        }
コード例 #4
0
        // Token: 0x060048D4 RID: 18644 RVA: 0x0014A980 File Offset: 0x00148B80
        public static Geometry GetFrozenClipForCell(IProvideDataGridColumn cell)
        {
            DataGridCellsPanel parentPanelForCell = DataGridHelper.GetParentPanelForCell(cell);

            if (parentPanelForCell != null)
            {
                return(parentPanelForCell.GetFrozenClipForChild((UIElement)cell));
            }
            return(null);
        }
コード例 #5
0
        /// <summary>
        ///     Invalidates a cell's panel if its column's width changes sufficiently.
        /// </summary>
        /// <param name="cell">The cell or header.</param>
        /// <param name="e"></param>
        public static void OnColumnWidthChanged(IProvideDataGridColumn cell, DependencyPropertyChangedEventArgs e)
        {
            Debug.Assert((cell is DataGridCell) || (cell is DataGridColumnHeader), "provideColumn should be one of the cell or header containers.");

            UIElement      element        = (UIElement)cell;
            DataGridColumn column         = cell.Column;
            bool           isColumnHeader = (cell is DataGridColumnHeader);

            if (column != null)
            {
                // determine the desired value of width for auto kind columns
                DataGridLength width = column.Width;
                if (width.IsAuto ||
                    (!isColumnHeader && width.IsSizeToCells) ||
                    (isColumnHeader && width.IsSizeToHeader))
                {
                    DataGridLength oldWidth     = (DataGridLength)e.OldValue;
                    double         desiredWidth = 0.0;
                    if (oldWidth.UnitType != width.UnitType)
                    {
                        double constraintWidth = column.GetConstraintWidth(isColumnHeader);
                        if (!DoubleUtil.AreClose(element.DesiredSize.Width, constraintWidth))
                        {
                            element.InvalidateMeasure();
                            element.Measure(new Size(constraintWidth, double.PositiveInfinity));
                        }

                        desiredWidth = element.DesiredSize.Width;
                    }
                    else
                    {
                        desiredWidth = oldWidth.DesiredValue;
                    }

                    if (DoubleUtil.IsNaN(width.DesiredValue) ||
                        DoubleUtil.LessThan(width.DesiredValue, desiredWidth))
                    {
                        column.SetWidthInternal(new DataGridLength(width.Value, width.UnitType, desiredWidth, width.DisplayValue));
                    }
                }
            }
        }
コード例 #6
0
        // Token: 0x060048D5 RID: 18645 RVA: 0x0014A9A8 File Offset: 0x00148BA8
        public static DataGridCellsPanel GetParentPanelForCell(IProvideDataGridColumn cell)
        {
            UIElement reference = (UIElement)cell;

            return(VisualTreeHelper.GetParent(reference) as DataGridCellsPanel);
        }