protected virtual void InitializeEditor(IInputEditor activeEditor) { GridCellElement currentCell = this.gridViewElement.CurrentView.CurrentCell; if (currentCell == null) { return; } ISupportInitialize supportInitialize = activeEditor as ISupportInitialize; supportInitialize?.BeginInit(); EventDispatcher eventDispatcher = this.GridViewElement.Template.EventDispatcher; eventDispatcher.SuspendEvent(EventDispatcher.ValueChanging); eventDispatcher.SuspendEvent(EventDispatcher.ValueChanged); currentCell.ColumnInfo.InitializeEditor(activeEditor); activeEditor.Initialize((object)currentCell, currentCell.Value); eventDispatcher.ResumeEvent(EventDispatcher.ValueChanging); eventDispatcher.ResumeEvent(EventDispatcher.ValueChanged); GridViewCellEventArgs args = new GridViewCellEventArgs(currentCell.RowInfo, currentCell.ColumnInfo, activeEditor); this.gridViewElement.Template.EventDispatcher.RaiseEvent <GridViewCellEventArgs>(EventDispatcher.CellEditorInitialized, (object)this, args); if (TelerikHelper.IsMaterialTheme(this.gridViewElement.GridControl.ThemeName)) { BaseInputEditor activeEditor1 = args.ActiveEditor as BaseInputEditor; if (activeEditor1 != null) { activeEditor1.EditorElement.StretchVertically = true; } } supportInitialize?.EndInit(); }
public float MeasureAutoSizeRow(RadElementCollection cells) { List <float> floatList = new List <float>(); Dictionary <GridViewColumn, ColumnGroupsCellArrangeInfo> columnsData = this.tree.GetColumnsData(); foreach (RadElement cell in cells) { GridCellElement gridCellElement = cell as GridCellElement; if (gridCellElement != null && columnsData.ContainsKey(gridCellElement.ColumnInfo)) { ColumnGroupsCellArrangeInfo groupsCellArrangeInfo = columnsData[gridCellElement.ColumnInfo]; if (!(gridCellElement.ColumnInfo is GridViewGroupColumn) || this.HasVisibleColumn(((GridViewGroupColumn)gridCellElement.ColumnInfo).Group)) { while (floatList.Count <= groupsCellArrangeInfo.Depth) { floatList.Add(0.0f); } floatList[groupsCellArrangeInfo.Depth] = Math.Max(floatList[groupsCellArrangeInfo.Depth], gridCellElement.DesiredSize.Height); } } } float num1 = 0.0f; foreach (float num2 in floatList) { num1 += num2; } return(num1); }
protected override bool SelectPositionOnMouseDownLeft( MouseEventArgs e, GridRowElement rowElement, GridCellElement cellElement) { return(false); }
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); }
public override bool OnMouseDoubleClick(MouseEventArgs e) { if (this.columnToResize != null && this.columnToResize.CanStretch && this.columnToResize.OwnerTemplate.AllowAutoSizeColumns) { if (this.RootGridBehavior.RowAtPoint is GridTableHeaderRowElement) { if (this.cellToResize != null) { this.cellToResize = this.GridViewElement.ElementTree.GetElementAtPoint(e.Location) as GridCellElement; this.cellToResize.TableElement.BestFitColumn(this.columnToResize); } else { this.columnToResize.BestFit(); } this.disableSortOrderChange = true; } this.ResetCursor(); } this.columnResizeStarted = false; this.mouseIsDown = false; this.GridControl.Capture = false; this.RootGridBehavior.UnlockBehavior((IGridBehavior)this); return(base.OnMouseDoubleClick(e)); }
public override RectangleF GetCellArrangeRect(RectangleF client, GridCellElement cell) { RectangleF cellArrangeRect = base.GetCellArrangeRect(client, cell); this.GetArrangeInfo(cell.ColumnInfo); return(cellArrangeRect); }
internal GridViewCellCancelEventArgs(GridCellElement cell, IInputEditor editor) { if (cell != null) { this.row = cell.RowInfo; this.column = cell.ColumnInfo; } this.activeEditor = editor; }
internal GridViewSelectionCancelEventArgs(GridCellElement cell) { if (cell == null) { return; } this.rows.Add(cell.RowInfo); this.column = cell.ColumnInfo; this.columnStartIndex = this.columnEndIndex = this.column.Index; }
private void editorElement_ValueChanged(object sender, EventArgs e) { GridCellElement ownerElement = this.OwnerElement as GridCellElement; if (ownerElement == null || ownerElement.ViewTemplate == null) { return; } ownerElement.ViewTemplate.EventDispatcher.RaiseEvent <EventArgs>(EventDispatcher.ValueChanged, (object)this, EventArgs.Empty); }
public override GridCellElement CreateCell(GridViewColumn column) { GridCellElement cell = base.CreateCell(column); if (cell is GridGroupExpanderCellElement) { cell.ThemeRole = "HierarchyExpanderCell"; } return(cell); }
public override RectangleF ArrangeCell(RectangleF clientRect, GridCellElement cell) { GridDataCellElement gridDataCellElement = cell as GridDataCellElement; if (gridDataCellElement != null) { gridDataCellElement.IsLeftMost = false; } return(this.LayoutImpl.GetCellArrangeRect(clientRect, cell)); }
public override GridCellElement CreateCell(GridViewColumn column) { GridCellElement cell = base.CreateCell(column); if (cell is GridHyperlinkCellElement) { cell.Class = "NewRowHyperlinkCellElement"; } return(cell); }
public override RectangleF ArrangeCell(RectangleF clientRect, GridCellElement cell) { RectangleF rectangleF1 = this.ArrangeCellCore(cell.ColumnInfo, cell.RowInfo, clientRect); if (this.ViewTemplate.IsSelfReference && cell is GridDataCellElement && (this.FirstDataColumn != null && cell.ColumnInfo != this.FirstDataColumn)) { RectangleF rectangleF2 = this.ArrangeCellCore((GridViewColumn)this.FirstDataColumn, cell.RowInfo, clientRect); ((GridDataCellElement)cell).IsLeftMost = cell.RightToLeft ? (double)Math.Abs(rectangleF2.Right - rectangleF1.Right) < 0.01 : (double)Math.Abs(rectangleF2.X - rectangleF1.X) < 0.01; } return(rectangleF1); }
protected GridTableElement GetTableElementAtPoint(Point point) { GridCellElement elementAtPoint = GridVisualElement.GetElementAtPoint <GridCellElement>((RadElementTree)this.GridViewElement.ElementTree, point); GridDetailViewCellElement detailViewCellElement = elementAtPoint as GridDetailViewCellElement; GridTableElement gridTableElement = elementAtPoint?.TableElement; if (detailViewCellElement != null) { gridTableElement = detailViewCellElement.ChildTableElement; } return(gridTableElement ?? this.GridViewElement.TableElement); }
public override bool OnMouseDown(MouseEventArgs e) { this.disableSortOrderChange = false; bool flag = true; if (this.GridViewElement.IsInEditMode) { flag = this.GridViewElement.EndEdit(); } if (e.Button == MouseButtons.Left) { this.FindCellToResize(e.Location); if (this.columnToResize != null) { this.mouseIsDown = true; this.mouseDownPoint = e.Location; this.GridControl.Capture = true; this.RootGridBehavior.LockBehavior((IGridBehavior)this); this.cellToResize = this.GridViewElement.ElementTree.GetElementAtPoint(e.Location) as GridCellElement; this.mouseDownCell = this.cellToResize; } else { if (!flag) { return(true); } GridHeaderCellElement cellAtPoint = this.RootGridBehavior.CellAtPoint as GridHeaderCellElement; if (GridVisualElement.GetElementAtPoint <RadButtonElement>((RadElementTree)this.GridViewElement.ElementTree, e.Location) != null) { return(false); } this.mouseDownCell = (GridCellElement)cellAtPoint; if (cellAtPoint == null || this.GetVisibleColumnsCount(cellAtPoint) < 2) { return(false); } RadDragDropService service = this.GridViewElement.GetService <RadDragDropService>(); if (service != null) { service.Start((object)new SnapshotDragItem((RadItem)cellAtPoint)); service.Stopped += new EventHandler(this.dragDropService_Stopped); this.dragDropStarted = service.State == RadServiceState.Working; } } } else if (e.Button == MouseButtons.Right) { this.RootGridBehavior.CellAtPoint?.ShowContextMenu(); } return(false); }
public override void Initialize(object owner, object value) { this.OwnerElement = owner as RadElement; this.originalValue = value; GridCellElement gridCellElement = owner as GridCellElement; if (gridCellElement != null) { value = RadDataConverter.Instance.Format(value, this.DataType, (IDataConversionInfoProvider)(gridCellElement as GridDataCellElement)); } this.initialValue = value; this.Value = value; }
public override void Initialize(object owner, object value) { this.OwnerElement = owner as RadElement; this.originalValue = value; GridCellElement gridCellElement = owner as GridCellElement; if (gridCellElement != null) { bool coerceNullValue = (object)this.DataType == (object)typeof(Telerik.WinControls.Enumerations.ToggleState); value = RadDataConverter.Instance.Format(value, this.DataType, coerceNullValue, (IDataConversionInfoProvider)(gridCellElement.ColumnInfo as GridViewDataColumn)); } this.Value = value; }
protected virtual void CheckChildViewExpandingEventIsCanceled(bool value) { if (this.Parent == null) { return; } GridCellElement ancestor = this.FindAncestor <GridCellElement>(); if (ancestor == null || ancestor.RowInfo == null || ancestor.RowInfo.IsExpanded == value) { return; } base.Expanded = ancestor.RowInfo.IsExpanded; }
protected virtual IGridBehavior GetRowBehaviorAtPoint(Point point) { this.rowAtPoint = GridVisualElement.GetElementAtPoint <GridRowElement>((RadElementTree)this.GridViewElement.ElementTree, point); this.cellAtPoint = GridVisualElement.GetElementAtPoint <GridCellElement>((RadElementTree)this.GridViewElement.ElementTree, point); if (this.lockedBehavior != null) { return(this.lockedBehavior); } if (this.rowAtPoint != null) { return(this.GetBehavior(this.rowAtPoint.RowInfo.GetType())); } return(this.GetCurrentRowBehavior()); }
protected override bool OnMouseUpLeft(MouseEventArgs e) { bool flag = base.OnMouseUpLeft(e); if (!flag && !this.GridViewElement.EditorManager.IsInEditMode) { GridCellElement cellAtPoint = this.RootGridBehavior.CellAtPoint; if (cellAtPoint != null && cellAtPoint.ColumnInfo != null && (cellAtPoint.ColumnInfo.ReadOnly && cellAtPoint.RowInfo is GridViewNewRowInfo)) { ((GridViewNewRowInfo)cellAtPoint.RowInfo).InitializeNewRow(); } } return(flag); }
public Rectangle GetCellElement(GridViewRowInfo row, GridViewColumn col) { IRowView rowView = this.owner.GridViewElement.GetRowView(row.ViewInfo); if (rowView != null) { GridCellElement cellElement = rowView.GetCellElement(row, col); if (cellElement != null) { return(cellElement.ControlBoundingRectangle); } } return(new Rectangle(0, 0, 0, 0)); }
public override bool CacheElement(IVirtualizedElement <GridViewColumn> element) { GridCellElement gridCellElement = element as GridCellElement; if (gridCellElement.RowInfo != null) { this.cachedElements.Add(new CellElementProvider.CellElementInfo(element, gridCellElement.RowInfo.GetType())); } else { (element as IDisposable)?.Dispose(); } return(true); }
private string GetText(object item) { GridCellElement gridCellElement = item as GridCellElement; if (gridCellElement != null) { return(gridCellElement.Text); } if (item != null) { return(Convert.ToString(item)); } return((string)null); }
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); } } }
public override void OnValueChanged() { if (this.restoringValue) { return; } base.OnValueChanged(); GridCellElement ownerElement = this.OwnerElement as GridCellElement; if (ownerElement == null || ownerElement.ViewTemplate == null) { return; } ownerElement.ViewTemplate.EventDispatcher.RaiseEvent <EventArgs>(EventDispatcher.ValueChanged, (object)this, EventArgs.Empty); }
private bool IsMouseInCellBounds(Point pt, GridCellElement cell, out int delta) { bool flag; if (this.GridViewElement.RightToLeft) { flag = pt.X >= cell.ControlBoundingRectangle.Left - this.ResizeCursorDistance && pt.X <= cell.ControlBoundingRectangle.Left + this.ResizeCursorDistance; delta = pt.X - cell.ControlBoundingRectangle.Left; } else { flag = pt.X >= cell.ControlBoundingRectangle.Right - this.ResizeCursorDistance && pt.X <= cell.ControlBoundingRectangle.Right + this.ResizeCursorDistance; delta = pt.X - cell.ControlBoundingRectangle.Right; } return(((flag ? 1 : 0) & (pt.Y > cell.ControlBoundingRectangle.Bottom ? 0 : (pt.Y >= cell.ControlBoundingRectangle.Top ? 1 : 0))) != 0); }
public virtual RectangleF GetCellArrangeRect(RectangleF client, GridCellElement cell) { TableViewCellArrangeInfo arrangeInfo = this.GetArrangeInfo(cell.ColumnInfo); if (arrangeInfo == null) { return(RectangleF.Empty); } RectangleF rectangleF = new RectangleF(client.X + (float)arrangeInfo.OffsetX, client.Y, (float)arrangeInfo.Column.Width, client.Height); if (cell.ElementTree.Control.RightToLeft == RightToLeft.Yes && cell.ColumnInfo != null && (cell.ColumnInfo.PinPosition == PinnedColumnPosition.None && (double)this.scrollableWidth > (double)client.Width)) { rectangleF.X -= (float)this.scrollableWidth - client.Width; } return(rectangleF); }
protected virtual void Dispose(bool disposing) { if (this.disposed) { return; } if (this.scrollTimer != null) { this.scrollTimer.Dispose(); this.scrollTimer = (Timer)null; } this.scrollBarAtPoint = (RadScrollBarElement)null; this.rowAtPoint = (GridRowElement)null; this.cellAtPoint = (GridCellElement)null; this.disposed = true; }
public override void OnMouseWheel(MouseEventArgs mouseEventArgs) { GridCellElement ownerElement = this.OwnerElement as GridCellElement; if (ownerElement == null || !ownerElement.IsInValidState(true) || !ownerElement.GridViewElement.EditorManager.IsInEditMode) { return; } ownerElement.GridViewElement.GridBehavior.OnMouseWheel(mouseEventArgs); HandledMouseEventArgs handledMouseEventArgs = mouseEventArgs as HandledMouseEventArgs; if (handledMouseEventArgs == null) { return; } handledMouseEventArgs.Handled = true; }
public virtual GridCellElement CreateCell(GridViewColumn column) { GridViewCreateCellEventArgs e = new GridViewCreateCellEventArgs(this, column, this.GetCellType(column)); this.GridViewElement.CallCreateCell(e); GridCellElement gridCellElement = (GridCellElement)null; if (e.CellElement != null) { gridCellElement = e.CellElement; } else if ((object)e.CellType != null) { gridCellElement = Activator.CreateInstance(e.CellType, (object)column, (object)this) as GridCellElement; } return(gridCellElement); }