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
        public override void Initialize(GridViewRowInfo rowInfo)
        {
            if (this.Children.Count == 0)
            {
                this.RowInfo = rowInfo;
                foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>) this.TableElement.ViewElement.RowLayout.RenderColumns)
                {
                    if (renderColumn is GridViewRowHeaderColumn)
                    {
                        GridCellElement cell = this.CreateCell(renderColumn);
                        if (cell != null)
                        {
                            if (cell is GridRowHeaderCellElement)
                            {
                                cell.ThemeRole = "GridRowHeaderCellElement";
                            }
                            this.Children.Add((RadElement)cell);
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (renderColumn is GridViewDataColumn)
                    {
                        break;
                    }
                }
                this.searchCellElement = (GridSearchCellElement)this.CreateCell((GridViewColumn)null);
                this.Children.Add((RadElement)this.searchCellElement);
                this.RowInfo = (GridViewRowInfo)null;
            }
            base.Initialize(rowInfo);
            int index = 0;

            for (IList <GridViewColumn> renderColumns = this.TableElement.ViewElement.RowLayout.RenderColumns; index < this.Children.Count && index < renderColumns.Count; ++index)
            {
                GridCellElement child  = this.Children[index] as GridCellElement;
                GridViewColumn  column = renderColumns[index];
                if (child != null)
                {
                    if (child is GridSearchCellElement)
                    {
                        column = (GridViewColumn)null;
                    }
                    child.Initialize(column, (GridRowElement)this);
                }
            }
        }
Exemplo n.º 3
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.º 4
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);
        }
        public override void Initialize(GridViewRowInfo rowInfo)
        {
            if (this.Children.Count == 0)
            {
                this.RowInfo = rowInfo;
                bool flag = false;
                foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>) this.TableElement.ViewElement.RowLayout.RenderColumns)
                {
                    if (renderColumn is GridViewIndentColumn || renderColumn is GridViewRowHeaderColumn)
                    {
                        GridCellElement cell = this.CreateCell(renderColumn);
                        if (cell != null)
                        {
                            if (cell is GridGroupExpanderCellElement)
                            {
                                this.expanderCell = (GridGroupExpanderCellElement)cell;
                                flag = true;
                            }
                            if (cell is GridIndentCellElement && flag)
                            {
                                cell.ThemeRole = "HierarchyIndentCell";
                            }
                            this.Children.Add((RadElement)cell);
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (renderColumn is GridViewDataColumn)
                    {
                        break;
                    }
                }
                this.contentCell = (GridGroupContentCellElement)this.CreateCell((GridViewColumn)null);
                this.Children.Add((RadElement)this.contentCell);
                this.RowInfo = (GridViewRowInfo)null;
            }
            GridViewGroupRowInfo viewGroupRowInfo = (GridViewGroupRowInfo)rowInfo;

            this.groupLevel = viewGroupRowInfo.GroupLevel;
            if (viewGroupRowInfo.ChildRows.Count > 0)
            {
                int num1 = (int)this.SetValue(GridGroupHeaderRowElement.ContainsGroupsProperty, (object)(viewGroupRowInfo.Group.Groups.Count > 0));
            }
            else
            {
                int num2 = (int)this.SetValue(GridGroupHeaderRowElement.ContainsGroupsProperty, (object)false);
            }
            base.Initialize(rowInfo);
            int index = 0;

            for (IList <GridViewColumn> renderColumns = this.TableElement.ViewElement.RowLayout.RenderColumns; index < this.Children.Count && index < renderColumns.Count; ++index)
            {
                GridCellElement child  = this.Children[index] as GridCellElement;
                GridViewColumn  column = renderColumns[index];
                if (child != null)
                {
                    if (child is GridGroupContentCellElement)
                    {
                        column = (GridViewColumn)null;
                    }
                    child.Initialize(column, (GridRowElement)this);
                }
            }
            if (this.expanderCell == null)
            {
                return;
            }
            this.expanderCell.Initialize(this.expanderCell.ColumnInfo, (GridRowElement)this);
        }