Exemplo n.º 1
0
        protected virtual float[] MeasureCells(
            GridViewRowInfo row,
            List <GridViewDataColumn> columns,
            float[] widths)
        {
            IVirtualizedElementProvider <GridViewColumn>  elementProvider1 = this.tableElement.ColumnScroller.ElementProvider;
            IVirtualizedElementProvider <GridViewRowInfo> elementProvider2 = this.tableElement.RowScroller.ElementProvider;

            if (this.CanBestFitRow(row))
            {
                GridRowElement element1 = elementProvider2.GetElement(row, (object)null) as GridRowElement;
                element1.InitializeRowView(this.TableElement);
                this.TableElement.Children.Add((RadElement)element1);
                element1.Initialize(row);
                for (int index = 0; index < columns.Count; ++index)
                {
                    if (columns[index].IsVisible && columns[index].AutoSizeMode != BestFitColumnMode.None)
                    {
                        GridCellElement element2 = elementProvider1.GetElement((GridViewColumn)columns[index], (object)element1) as GridCellElement;
                        element1.Children.Add((RadElement)element2);
                        element2.Initialize((GridViewColumn)columns[index], element1);
                        element2.SetContent();
                        element2.UpdateInfo();
                        (element2 as GridHeaderCellElement)?.UpdateArrowState();
                        element2.ResetLayout(true);
                        widths[index] = Math.Max(widths[index], this.GetCellDesiredWidth(element2));
                        element1.Children.Remove((RadElement)element2);
                        this.Detach(elementProvider1, element2);
                    }
                }
                this.TableElement.Children.Remove((RadElement)element1);
                this.Detach(elementProvider2, element1);
            }
            return(widths);
        }
Exemplo n.º 2
0
        protected internal virtual int GetDataRowHeight(
            GridViewRowInfo row,
            TableViewRowLayoutBase rowLayout)
        {
            if (!this.GridView.AutoSizeRows)
            {
                return(rowLayout.GetRowHeight(row));
            }
            IVirtualizedElementProvider <GridViewColumn>  elementProvider1 = this.GridView.TableElement.ColumnScroller.ElementProvider;
            IVirtualizedElementProvider <GridViewRowInfo> elementProvider2 = this.GridView.TableElement.RowScroller.ElementProvider;
            float          val1     = 0.0f;
            GridRowElement element1 = elementProvider2.GetElement(row, (object)null) as GridRowElement;

            element1.InitializeRowView(this.GridView.TableElement);
            element1.Initialize(row);
            this.GridView.TableElement.Children.Add((RadElement)element1);
            if (row is GridViewGroupRowInfo)
            {
                GridGroupHeaderRowElement headerRowElement = element1 as GridGroupHeaderRowElement;
                headerRowElement.Measure(new SizeF(rowLayout.DesiredSize.Width, float.PositiveInfinity));
                val1 = Math.Max(val1, headerRowElement.DesiredSize.Height);
            }
            else
            {
                foreach (GridViewColumn column in (Collection <GridViewDataColumn>)row.ViewTemplate.Columns)
                {
                    if (!(column is GridViewRowHeaderColumn) && !(column is GridViewIndentColumn) && column.IsVisible)
                    {
                        GridCellElement element2 = elementProvider1.GetElement(column, (object)element1) as GridCellElement;
                        element1.Children.Add((RadElement)element2);
                        element2.Initialize(column, element1);
                        element2.SetContent();
                        element2.UpdateInfo();
                        (element2 as GridHeaderCellElement)?.UpdateArrowState();
                        element2.ResetLayout(true);
                        val1 = Math.Max(val1, this.GetCellDesiredSize(element2).Height);
                        element1.Children.Remove((RadElement)element2);
                        this.Detach(elementProvider1, element2);
                    }
                }
            }
            this.GridView.TableElement.Children.Remove((RadElement)element1);
            this.Detach(elementProvider2, element1);
            return((int)val1);
        }
Exemplo n.º 3
0
        protected virtual float MeasureCell(
            GridViewRowInfo row,
            GridViewColumn column,
            BestFitColumnMode mode)
        {
            float val1 = 0.0f;
            IVirtualizedElementProvider <GridViewColumn>  elementProvider1 = this.tableElement.ColumnScroller.ElementProvider;
            IVirtualizedElementProvider <GridViewRowInfo> elementProvider2 = this.tableElement.RowScroller.ElementProvider;

            if (this.CanBestFitRow(row))
            {
                GridRowElement element1 = elementProvider2.GetElement(row, (object)null) as GridRowElement;
                element1.InitializeRowView(this.TableElement);
                this.TableElement.Children.Add((RadElement)element1);
                element1.Initialize(row);
                GridCellElement element2 = elementProvider1.GetElement(column, (object)element1) as GridCellElement;
                if (!element2.CanBestFit(mode))
                {
                    this.Detach(elementProvider1, element2);
                    this.Detach(elementProvider2, element1);
                    return(val1);
                }
                element1.Children.Add((RadElement)element2);
                element2.Initialize(column, element1);
                element2.SetContent();
                element2.UpdateInfo();
                (element2 as GridHeaderCellElement)?.UpdateArrowState();
                element2.ResetLayout(true);
                val1 = Math.Max(val1, this.GetCellDesiredWidth(element2));
                element1.Children.Remove((RadElement)element2);
                this.TableElement.Children.Remove((RadElement)element1);
                this.Detach(elementProvider1, element2);
                this.Detach(elementProvider2, element1);
            }
            return(val1);
        }