private void ScrollColumns(GridTableElement tableElement, Point location) { GridTableHeaderRowElement rowElement = tableElement.GetRowElement((GridViewRowInfo)tableElement.ViewInfo.TableHeaderRow) as GridTableHeaderRowElement; if (rowElement == null) { return; } Rectangle boundingRectangle1 = rowElement.ControlBoundingRectangle; Rectangle boundingRectangle2 = rowElement.ScrollableColumns.ControlBoundingRectangle; int num = 0; if (location.X > boundingRectangle2.Right) { num = location.X - boundingRectangle2.Right; } else if (location.X < boundingRectangle2.X) { num = location.X - boundingRectangle2.X; } RadScrollBarElement hscrollBar = tableElement.HScrollBar; if (tableElement.RightToLeft) { num *= -1; } if (num == 0 || hscrollBar.Visibility != ElementVisibility.Visible) { return; } hscrollBar.Value = this.ClampValue(hscrollBar.Value + num, hscrollBar.Minimum, hscrollBar.Maximum - hscrollBar.LargeChange + 1); }
private GridTableHeaderRowElement GetHeaderRowElement() { foreach (GridRowElement visualRow in (VisualRowsCollection)this.TableElement.VisualRows) { GridTableHeaderRowElement headerRowElement = visualRow as GridTableHeaderRowElement; if (headerRowElement != null) { return(headerRowElement); } } return((GridTableHeaderRowElement)null); }
private void BestFitGroupColumn( GridViewGroupColumn column, bool bestFitChildColumns, BestFitColumnMode?mode) { GridTableHeaderRowElement headerRowElement = this.GetHeaderRowElement(); IVirtualizedElementProvider <GridViewColumn> elementProvider = this.tableElement.ColumnScroller.ElementProvider; ColumnGroupRowLayout rowLayout = this.tableElement.ViewElement.RowLayout as ColumnGroupRowLayout; if (rowLayout == null || headerRowElement == null) { return; } GridColumnGroupCellElement element = elementProvider.GetElement((GridViewColumn)column, (object)headerRowElement) as GridColumnGroupCellElement; if (element == null || !element.CanBestFit(column.AutoSizeMode)) { return; } float num = this.MeasureCell((GridRowElement)headerRowElement, (GridViewColumn)column, element); this.Detach(elementProvider, (GridCellElement)element); ColumnGroupsCellArrangeInfo columnData = rowLayout.GetColumnData((GridViewColumn)column); if ((double)columnData.Bounds.Width < (double)num) { rowLayout.StartColumnResize((GridViewColumn)column); rowLayout.ResizeColumn((int)((double)num - (double)columnData.Bounds.Width)); rowLayout.InvalidateLayout(); this.TableElement.ViewElement.InvalidateMeasure(true); this.TableElement.ViewElement.UpdateLayout(); rowLayout.EndColumnResize(); } if (!bestFitChildColumns) { return; } foreach (GridViewColumn dataColumn in this.GetDataColumns(column.Group)) { this.BestFitColumnCore(dataColumn, mode.HasValue ? mode.Value : column.AutoSizeMode); } }
private bool FindCellToResize(Point pt) { GridTableHeaderRowElement rowAtPoint = this.RootGridBehavior.RowAtPoint as GridTableHeaderRowElement; if (rowAtPoint == null || pt.X > rowAtPoint.ControlBoundingRectangle.Right) { return(false); } for (int index = 0; index < rowAtPoint.VisualCells.Count; ++index) { GridCellElement visualCell = rowAtPoint.VisualCells[index]; GridHeaderCellElement headerCellElement = visualCell as GridHeaderCellElement; if (headerCellElement != null && headerCellElement.ColumnInfo != null && (headerCellElement.ColumnInfo.AllowResize && headerCellElement.ColumnInfo.OwnerTemplate.AllowColumnResize)) { if (headerCellElement.ColumnInfo.MaxWidth == 0 || headerCellElement.ColumnInfo.MaxWidth != headerCellElement.ColumnInfo.MinWidth) { int delta1 = 0; int delta2 = 0; bool flag = this.IsMouseInCellBounds(pt, visualCell, out delta1); GridCellElement elementAtPoint = headerCellElement.ElementTree.GetElementAtPoint(pt) as GridCellElement; if (flag && elementAtPoint != null && (this.IsMouseInCellBounds(pt, elementAtPoint, out delta2) && delta2 < delta1)) { this.SetResizeCursor(elementAtPoint.ColumnInfo); this.rowLayout = rowAtPoint.TableElement.ViewElement.RowLayout; return(true); } if (flag) { this.SetResizeCursor(headerCellElement.ColumnInfo); this.rowLayout = rowAtPoint.TableElement.ViewElement.RowLayout; return(true); } } } } return(false); }