internal static double GetRowHeight( RadGridView radGridView, RowElementProvider rowProvider, CellElementProvider cellProvider, GridViewRowInfo gridViewRowInfo, bool exportVisualSettings) { double val1 = 0.0; if (radGridView.AutoSizeRows && exportVisualSettings) { GridRowElement element1 = rowProvider.GetElement(gridViewRowInfo, (object)null) as GridRowElement; element1.InitializeRowView(radGridView.TableElement); element1.Initialize(gridViewRowInfo); radGridView.TableElement.Children.Add((RadElement)element1); foreach (GridViewColumn column in (Collection <GridViewDataColumn>)element1.ViewTemplate.Columns) { if (!(column is GridViewRowHeaderColumn) && !(column is GridViewIndentColumn)) { GridCellElement element2 = cellProvider.GetElement(column, (object)element1) as GridCellElement; element1.Children.Add((RadElement)element2); element2.Initialize(column, element1); val1 = Math.Max(val1, (double)GridExportUtils.GetCellDesiredSize(element2).Height); GridExportUtils.ReleaseCellElement(cellProvider, element1, element2); } } GridExportUtils.ReleaseRowElement(radGridView, rowProvider, element1); } return(Math.Max(val1, (double)radGridView.TableElement.RowScroller.ElementProvider.GetElementSize(gridViewRowInfo).Height)); }
internal static void ReleaseCellElement( CellElementProvider cellProvider, GridRowElement rowElement, GridCellElement cell) { GridExportUtils.ReleaseCellElement(cellProvider, rowElement, cell, true); }
protected override SizeF MeasureOverride(SizeF availableSize) { var cachedHeight = ((MyGrid)this.GridControl).CachedHeight; SizeF baseSize = base.MeasureOverride(availableSize); Padding borderThickness = GetBorderThickness(false); if (cachedHeight.ContainsKey(this.RowInfo)) { return(new SizeF(baseSize.Width, cachedHeight[this.RowInfo])); } CellElementProvider provider = new CellElementProvider(this.TableElement); SizeF desiredSize = SizeF.Empty; foreach (GridViewColumn column in this.ViewTemplate.Columns) { if (!this.IsColumnVisible(column)) { continue; } GridDataCellElement cellElement = provider.GetElement(column, this) as GridDataCellElement; this.Children.Add(cellElement); if (cellElement != null) { cellElement.Measure(new SizeF(column.Width, float.PositiveInfinity)); if (desiredSize.Height < cellElement.DesiredSize.Height) { desiredSize.Height = cellElement.DesiredSize.Height; } } cellElement.Detach(); this.Children.Remove(cellElement); } SizeF elementSize = this.TableElement.RowScroller.ElementProvider.GetElementSize(this.RowInfo); int oldHeight = RowInfo.Height == -1 ? (int)elementSize.Height : RowInfo.Height; this.RowInfo.SuspendPropertyNotifications(); var newHeight = Math.Min(this.RowInfo.Height, (int)desiredSize.Height); this.RowInfo.Height = Math.Max((int)desiredSize.Height, Math.Max(newHeight, Math.Max(this.RowInfo.MinHeight, 24))); this.RowInfo.Height = (int)desiredSize.Height; if (!cachedHeight.ContainsKey(this.RowInfo)) { cachedHeight.Add(this.RowInfo, this.RowInfo.Height); } this.RowInfo.ResumePropertyNotifications(); if (!this.RowInfo.IsPinned) { int delta = RowInfo.Height - oldHeight; TableElement.RowScroller.UpdateScrollRange(TableElement.RowScroller.Scrollbar.Maximum + delta, false); } baseSize.Height = this.RowInfo.Height; return(baseSize); }
internal static void ReleaseCellElement( CellElementProvider cellProvider, GridRowElement rowElement, GridCellElement cell, bool cache) { GridVirtualizedCellElement virtualizedCellElement = cell as GridVirtualizedCellElement; if (virtualizedCellElement != null) { if (cache) { cellProvider.CacheElement((IVirtualizedElement <GridViewColumn>)virtualizedCellElement); } virtualizedCellElement.Detach(); rowElement.Children.Remove((RadElement)cell); } else { cell.Dispose(); } }