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 GridSearchCellElement(GridViewColumn column, GridRowElement row) : base(column, row) { this.timer = new Timer(); this.timer.Interval = 100; this.timer.Tick += new EventHandler(this.Timer_Tick); GridViewSearchRowInfo rowInfo = this.RowInfo as GridViewSearchRowInfo; if (rowInfo != null) { this.timer.Interval = rowInfo.SearchDelay; rowInfo.PropertyChanged += new PropertyChangedEventHandler(this.searchRow_PropertyChanged); rowInfo.SearchProgressChanged += new SearchProgressChangedEventHandler(this.searchRow_SearchProgressChanged); this.MatchCaseMenuItem.IsChecked = rowInfo.CaseSensitive; this.changingMatchCasemenuItemValue = true; this.matchCaseButton.ToggleState = this.MatchCaseMenuItem.IsChecked ? Telerik.WinControls.Enumerations.ToggleState.On : Telerik.WinControls.Enumerations.ToggleState.Off; this.changingMatchCasemenuItemValue = false; this.SearchFromCurrentPositionMenuItem.IsChecked = rowInfo.SearchFromCurrentPosition; this.SearchTextBox.ShowClearButton = rowInfo.ShowClearButton; this.CloseButton.Visibility = rowInfo.ShowCloseButton ? ElementVisibility.Visible : ElementVisibility.Collapsed; } this.searchTextBox.KeyDown += new KeyEventHandler(this.searchTextBox_KeyDown); this.searchTextBox.MouseDown += new MouseEventHandler(this.SearchTextBox_MouseDown); this.findNextButton.Click += new EventHandler(this.findNextButton_Click); this.findPreviousButton.Click += new EventHandler(this.findPreviousButton_Click); this.searchTextBox.TextChanged += new EventHandler(this.searchTextBox_TextChanged); this.findNextButton.MouseEnter += new EventHandler(this.findNextButton_MouseEnter); this.findPreviousButton.MouseEnter += new EventHandler(this.findPreviousButton_MouseEnter); this.matchCaseButton.ToggleStateChanged += new StateChangedEventHandler(this.matchCaseButton_ToggleStateChanged); this.optionsButton.DropDownOpening += new CancelEventHandler(this.OptionsButton_DropDownOpening); this.chooseColumnsMenuItem.DropDownClosing += new RadPopupClosingEventHandler(this.ChooseColumnsMenuItem_DropDownClosing); this.matchCaseMenuItem.Click += new EventHandler(this.MatchCaseMenuItem_Click); this.searchFromCurrentPositionMenuItem.Click += new EventHandler(this.SearchFromCurrentFromPositionMenuItem_Click); LocalizationProvider <RadGridLocalizationProvider> .CurrentProviderChanged += new EventHandler(this.RadGridLocalizationProvider_CurrentProviderChanged); }
protected override bool SelectPositionOnMouseDownLeft( MouseEventArgs e, GridRowElement rowElement, GridCellElement cellElement) { return(false); }
private bool EnsureRowVisibleByTraverserDown( RadScrollBarElement vScrollBar, GridViewRowInfo rowInfo, ScrollableRowsContainerElement rows, float delta) { GridRowElement child = (GridRowElement)rows.Children[rows.Children.Count - 1]; GridTraverser enumerator = (GridTraverser)((IEnumerable)this.RowScroller).GetEnumerator(); while (enumerator.Current is GridViewDetailsRowInfo) { enumerator.MoveNext(); } enumerator.MovePrevious(); if (enumerator.Current == rowInfo) { return(this.ChangeScrollbarValue(vScrollBar, vScrollBar.Value - (int)delta)); } do { ; }while (enumerator.MoveNext() && enumerator.Current != child.RowInfo); enumerator.MoveNext(); if (enumerator.Current == rowInfo) { return(this.ChangeScrollbarValue(vScrollBar, vScrollBar.Value + (int)delta)); } return(false); }
protected virtual bool EnsureRowVisibleCore(GridViewRowInfo rowInfo) { bool isTraverserd = false; bool isLastRow = false; bool isFirstRow = false; GridRowElement row = this.GetRowElement(rowInfo); this.DetermineScrollableRowPosition(rowInfo, out isFirstRow, out isLastRow); ScrollableRowsContainerElement scrollableRows = this.ViewElement.ScrollableRows; RadScrollBarElement vericalScrollBar = this.UseScrollbarsInHierarchy ? this.VScrollBar : this.MasterVScrollBar; if (row == null && this.TryEnsureRowVisibilityByTraverser(rowInfo, isLastRow, vericalScrollBar, scrollableRows, out row, out isTraverserd)) { return(isTraverserd); } RectangleF boundingRectangle1 = (RectangleF)this.MasterTableElement.ViewElement.ScrollableRows.ControlBoundingRectangle; RectangleF innerClientRectangle = this.GetInnerClientRectangle(rowInfo); Rectangle boundingRectangle2 = row.ControlBoundingRectangle; int scrollValue = vericalScrollBar.Value; if (this.GridViewElement.SplitMode != RadGridViewSplitMode.None && this.MasterTableElement != row.TableElement) { return(false); } if ((double)boundingRectangle2.Bottom > (double)boundingRectangle1.Bottom || (double)boundingRectangle2.Bottom > (double)innerClientRectangle.Bottom) { this.EnsureRowVisibilityAtBottom(rowInfo, isLastRow, (RectangleF)boundingRectangle2, innerClientRectangle, ref vericalScrollBar, ref scrollValue); } else if ((double)boundingRectangle2.Y < (double)boundingRectangle1.Y || this.ParentHScrollBar.Visibility == ElementVisibility.Visible && this.ParentHScrollBar.ControlBoundingRectangle.IntersectsWith(boundingRectangle2) || this.UseScrollbarsInHierarchy && (double)boundingRectangle2.Y < (double)innerClientRectangle.Y) { this.EnsureRowVisibilityAtTop((RectangleF)boundingRectangle2, boundingRectangle1, innerClientRectangle, ref vericalScrollBar, ref scrollValue); } return(this.ChangeScrollbarValue(vericalScrollBar, scrollValue)); }
protected virtual bool TryEnsureRowVisibilityByTraverser( GridViewRowInfo rowInfo, bool isLastRow, RadScrollBarElement verticalScrollBar, ScrollableRowsContainerElement scrollableRows, out GridRowElement row, out bool isTraverserd) { int num = verticalScrollBar.Maximum - verticalScrollBar.LargeChange + 1; if (isLastRow && num != verticalScrollBar.Value) { this.ChangeScrollbarValue(verticalScrollBar, num); this.UpdateLayout(); } row = this.GetRowElement(rowInfo); isTraverserd = false; if (row != null) { return(false); } int height = (int)this.RowScroller.ElementProvider.GetElementSize(rowInfo).Height; this.EnsureScrollingDelta(rowInfo, isLastRow, ref height); if (this.UseScrollbarsInHierarchy && scrollableRows.Children.Count > 0) { GridDetailViewRowElement child = scrollableRows.Children[scrollableRows.Children.Count - 1] as GridDetailViewRowElement; height += child != null ? child.RowInfo.Height - child.Size.Height : 0; } isTraverserd = this.EnsureRowVisibleByTraverser(verticalScrollBar, rowInfo, (float)height); return(true); }
public override void Initialize(GridViewColumn column, GridRowElement row) { this.UnbindRowProperties(); base.Initialize(column, row); this.BindRowProperties(); this.SetContent(); this.UpdateInfo(); }
public virtual void Initialize(GridViewColumn column, GridRowElement row) { this.column = column; this.rowElement = row; if (row == null) return; this.row = row.RowInfo; }
public GridRatingCellElement(GridViewColumn column, GridRowElement row) : base(column, row) { foreach (RadElement radElement in (RadItemCollection)this.rating.Items) { radElement.Margin = new Padding(0); } }
public GridViewCreateCellEventArgs( GridRowElement row, GridViewColumn column, Type defaultCellType) { this.row = row; this.column = column; this.cellType = defaultCellType; }
public override Point GetDragHintLocation(ISupportDrop dropTarget, Point mousePosition) { GridRowElement gridRowElement = dropTarget as GridRowElement; Rectangle screen = this.GridViewElement.ElementTree.Control.RectangleToScreen(gridRowElement.ControlBoundingRectangle); Size size = this.DragHint.Image.Size; Padding margins = this.DragHint.Margins; int num = RadGridViewDragDropService.IsDroppedAtTop(gridRowElement.PointFromScreen(mousePosition), gridRowElement.Size.Height) ? screen.Y : screen.Bottom; return(new Point(screen.X - margins.Left, num - size.Height / 2)); }
private void SetHoveredRow() { GridRowElement gridRowElement = (GridRowElement)null; if (this.IsMouseOverElement) { gridRowElement = this; } this.TableElement.HoveredRow = gridRowElement; }
public override void Initialize(GridViewColumn column, GridRowElement row) { base.Initialize(column, row); GridViewHyperlinkCellInfo cell = this.RowInfo.Cells[this.ColumnInfo.Name] as GridViewHyperlinkCellInfo; if (cell == null) { return; } this.contentElement.Visited = cell.Visited; }
public override Size GetDragHintSize(ISupportDrop dropTarget) { int height = this.DragHint.Image.Size.Height; int width = this.GridViewElement.Size.Width; GridRowElement gridRowElement = dropTarget as GridRowElement; if (gridRowElement != null) { width = gridRowElement.Size.Width; } return(new Size(width, height)); }
public override void Initialize(GridViewColumn column, GridRowElement row) { base.Initialize(column, row); if (this.RowInfo is GridViewGroupRowInfo) { this.expander.ThemeRole = "GroupExpander"; } else { this.expander.ThemeRole = "HierarchyExpander"; } this.expander.Expanded = row.Data.IsExpanded; }
public override void Initialize(GridViewColumn column, GridRowElement row) { base.Initialize(column, row); this.UpdateInfo(); GridViewSearchRowInfo rowInfo = this.RowInfo as GridViewSearchRowInfo; if (rowInfo == null) { return; } this.SyncLabelText(); this.SyncCriteriaToTextBox(rowInfo); }
public Rectangle GetRowElement(GridViewRowInfo row) { IRowView rowView = this.owner.GridViewElement.GetRowView(row.ViewInfo); if (rowView != null) { GridRowElement rowElement = rowView.GetRowElement(row); if (rowElement != null) { return(rowElement.ControlBoundingRectangle); } } return(new Rectangle(0, 0, 0, 0)); }
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 virtual bool EnsureRowVisibleByTraverser( RadScrollBarElement vScrollBar, GridViewRowInfo rowInfo, float delta) { ScrollableRowsContainerElement scrollableRows = this.ViewElement.ScrollableRows; RadElementCollection children = scrollableRows.Children; int num1 = vScrollBar.Maximum - vScrollBar.LargeChange + 1; while (vScrollBar.Maximum != 0 && children.Count == 0) { this.ChangeScrollbarValue(vScrollBar, vScrollBar.Value + 1); this.UpdateLayout(); if (scrollableRows.Children.Count > 0 || vScrollBar.Value == num1 || vScrollBar.Value == vScrollBar.Maximum) { break; } } if (children.Count == 0) { return(false); } if (this.EnsureRowVisibleByTraverserDown(vScrollBar, rowInfo, scrollableRows, delta)) { return(true); } GridRowElement child = (GridRowElement)scrollableRows.Children[0]; if (((GridTraverser)((IEnumerable)this.RowScroller).GetEnumerator()).Current == rowInfo) { int num2 = vScrollBar.Value - (int)delta; if (num2 < vScrollBar.Minimum) { num2 = vScrollBar.Minimum; } else if (num2 > vScrollBar.Maximum) { num2 = vScrollBar.Maximum; } return(this.ChangeScrollbarValue(vScrollBar, num2)); } GridViewGroupRowInfo parent = rowInfo.Parent as GridViewGroupRowInfo; if (parent != null && !parent.IsExpanded) { return(false); } return(this.RowScroller.ScrollToItem(rowInfo, false)); }
public GridDetailViewCellElement(GridViewColumn column, GridRowElement row) : base(column, row) { if (this.ViewTemplate.Templates.Count > 1 || row.ViewTemplate.ShowChildViewCaptions) { IRadPageViewProvider pageViewProvider = this.CreatePageViewProvider(); this.pageViewElement = this.CreatePageViewElement(pageViewProvider); this.UpdateTabsPosition(); this.UpdatePageViewItems(pageViewProvider); } else { this.Children.Add((RadElement)this.CreateChildTableElement()); } }
public override void Initialize(GridViewColumn column, GridRowElement row) { base.Initialize(column, row); this.UpdateTabsPosition(); this.ViewTemplate.PropertyChanged += new PropertyChangedEventHandler(this.ViewTemplate_PropertyChanged); if (this.pageViewElement == null) { return; } foreach (RadPageViewItem radPageViewItem in (IEnumerable <RadPageViewItem>) this.pageViewElement.Items) { radPageViewItem.RadPropertyChanging += new RadPropertyChangingEventHandler(this.item_RadPropertyChanging); radPageViewItem.RadPropertyChanged += new RadPropertyChangedEventHandler(this.item_RadPropertyChanged); } }
protected override bool OnMouseDownLeft(MouseEventArgs e) { GridRowElement rowAtPoint = this.GetRowAtPoint(e.Location); if (rowAtPoint != null && rowAtPoint.GridViewElement.TableElement.PageViewMode == PageViewMode.ExplorerBar) { GridViewHierarchyRowInfo parent = rowAtPoint.RowInfo.Parent as GridViewHierarchyRowInfo; if (parent != null) { this.GridViewElement.CurrentRow.IsSelected = false; parent.ActiveView = rowAtPoint.RowInfo.ViewInfo; } } return(base.OnMouseDownLeft(e)); }
private void CorrectScrollbarRangeInHierarchy() { GridTableElement tableElement = ((RowsContainerElement)this.Parent).TableElement; RadGridViewElement gridViewElement = tableElement.GridViewElement; RadScrollBarElement vscrollBar = tableElement.VScrollBar; MasterGridViewTemplate masterTemplate = tableElement.MasterTemplate; if (masterTemplate == null || masterTemplate.Templates.Count == 0 || (gridViewElement.UseScrollbarsInHierarchy || tableElement.ViewInfo.ParentRow != null) || (this.Children.Count == 0 || vscrollBar.Value < vscrollBar.Maximum - vscrollBar.LargeChange + 1)) { return; } GridDetailViewRowElement child1 = this.Children[this.Children.Count - 1] as GridDetailViewRowElement; if (child1 == null || child1.ContentCell.ChildTableElement.ViewInfo == null) { return; } ScrollableRowsContainerElement scrollableRows = child1.ContentCell.ChildTableElement.ViewElement.ScrollableRows; int count = scrollableRows.Children.Count; GridTraverser gridTraverser = new GridTraverser(child1.ContentCell.ChildTableElement.ViewInfo); gridTraverser.TraversalMode = GridTraverser.TraversalModes.ScrollableRows; int num1 = 0; while (gridTraverser.MoveNext()) { ++num1; if (num1 > count) { int height = (int)child1.ContentCell.ChildTableElement.RowElementProvider.GetElementSize(gridTraverser.Current).Height; tableElement.RowScroller.UpdateScrollRange(vscrollBar.Maximum + height, false); return; } } if (scrollableRows.Children.Count <= 0) { return; } GridRowElement child2 = (GridRowElement)scrollableRows.Children[scrollableRows.Children.Count - 1]; if (child2.ControlBoundingRectangle.Bottom <= scrollableRows.ControlBoundingRectangle.Bottom) { return; } int num2 = child2.ControlBoundingRectangle.Bottom - scrollableRows.ControlBoundingRectangle.Bottom; tableElement.RowScroller.UpdateScrollRange(vscrollBar.Maximum + num2, false); }
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 SelfReferenceCellLayout(GridRowElement rowElement) { this.rowElement = rowElement; this.hierarchyLinks = new List <GridLinkItem>(); this.linksCache = new List <GridLinkItem>(); this.stackLayoutElement = new StackLayoutElement(); this.stackLayoutElement.StretchVertically = true; this.stackLayoutElement.StretchHorizontally = true; int num = (int)this.stackLayoutElement.SetDefaultValueOverride(RadElement.FitToSizeModeProperty, (object)RadFitToSizeMode.FitToParentBounds); this.expander = new GridTreeExpanderItem(rowElement.TableElement); this.expander.ThemeRole = "SelfReferencingExpander"; this.expander.StretchVertically = true; this.stackLayoutElement.Children.Add((RadElement)this.expander); this.BindRowProperties(); }
public override bool CanResizeRow(Point currentLocation, GridRowElement rowElement) { if (!this.GridViewElement.UseScrollbarsInHierarchy || rowElement == null) { return(false); } Rectangle boundingRectangle = rowElement.ControlBoundingRectangle; if (currentLocation.Y < boundingRectangle.Bottom - 2 || currentLocation.Y > boundingRectangle.Bottom + 2) { return(false); } GridViewRowInfo rowInfo = rowElement.RowInfo; return(true); }
private float MeasureCell( GridRowElement row, GridViewColumn column, GridColumnGroupCellElement cell) { cell.Initialize(column, row); cell.SetContent(); cell.UpdateInfo(); row.SuspendLayout(); row.Children.Add((RadElement)cell); cell.ResetLayout(true); float cellDesiredWidth = this.GetCellDesiredWidth((GridCellElement)cell); row.Children.Remove((RadElement)cell); row.ResumeLayout(false); return(cellDesiredWidth); }
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); }
private bool IsCompatible( CellElementProvider.CellElementInfo info, GridViewColumn data, object context) { bool flag = true; GridRowElement gridRowElement = context as GridRowElement; if (gridRowElement != null) { flag = (object)gridRowElement.RowInfo.GetType() == (object)info.RowInfoType; } if (flag) { return(this.IsCompatible(info.Element, data, context)); } return(false); }
public override void Initialize(GridViewColumn column, GridRowElement row) { bool flag1 = column != null && column != this.ColumnInfo; bool flag2 = row != null && (row != this.RowElement || row.RowInfo != this.RowInfo); base.Initialize(column, row); if (flag1 || this.bindingsSuspended && column != null) { this.BindColumnProperties(); } if (flag2 || this.bindingsSuspended && row != null && row.RowInfo != null) { this.BindRowProperties(); } this.bindingsSuspended = false; if (flag1 || flag2) { this.SetContent(); } this.UpdateInfo(); }