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 void DetermineScrollableRowPosition( GridViewRowInfo rowInfo, out bool isFirstRow, out bool isLastRow) { isFirstRow = false; isLastRow = false; if (rowInfo.IsPinned) { return; } GridViewInfo viewInfo = this.GridViewElement.Template.MasterViewInfo; if (this.GridViewElement.UseScrollbarsInHierarchy) { viewInfo = this.TableElement.ViewInfo; } GridTraverser gridTraverser = new GridTraverser(viewInfo); gridTraverser.Reset(); gridTraverser.MoveNext(); isFirstRow = gridTraverser.Current == rowInfo; if (isFirstRow) { return; } gridTraverser.MoveToEnd(); isLastRow = gridTraverser.Current == rowInfo; }
private void UpdateChildRowHeight(int newHeight, SizeF availableSize) { GridViewDetailsRowInfo data = (GridViewDetailsRowInfo)this.Data; if (data.ActualHeight == newHeight) { return; } int num1 = data.ActualHeight == -1 ? 0 : data.ActualHeight; int num2 = newHeight - num1; if (num1 != 0 && !data.resetActualHeight) { GridTraverser gridTraverser = new GridTraverser((GridTraverser)this.TableElement.RowScroller.Traverser); gridTraverser.ProcessHierarchy = false; do { ; }while (gridTraverser.Current != data && gridTraverser.MoveNext()); if (!gridTraverser.MoveNext()) { return; } } data.resetActualHeight = false; data.ActualHeight = newHeight; if (!this.GridViewElement.UseScrollbarsInHierarchy && this.TableElement.ViewInfo.ParentRow != null) { return; } RowScroller rowScroller = this.TableElement.RowScroller; if (num1 == 0) { rowScroller.UpdateScrollRange(); } else { rowScroller.UpdateScrollRange(rowScroller.Scrollbar.Maximum + num2, false); } }
protected GridViewRowInfo GetFirstScrollableRow( GridTableElement tableElement, bool checkBounds) { ScrollableRowsContainerElement scrollableRows = tableElement.ViewElement.ScrollableRows; GridTraverser enumerator = (GridTraverser)((IEnumerable)tableElement.RowScroller).GetEnumerator(); if (enumerator.Current == null) { enumerator.MoveNext(); } return(enumerator.Current); }
protected virtual int GetCurrentCellTraverserRowIndex() { GridTraverser traverser = this.CreateTraverser(); int num = -1; while (traverser.MoveNext()) { ++num; if (traverser.Current == this.ViewTemplate.MasterTemplate.Owner.CurrentRow) { return(num); } } return(-1); }
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 UpdateAlternatingRowColor() { bool flag1 = false; if (this.ViewTemplate.EnableAlternatingRowColor) { if (this.ViewTemplate.IsSelfReference) { GridTraverser gridTraverser = new GridTraverser(this.ViewInfo, GridTraverser.TraversalModes.ScrollableRows); bool flag2 = false; while (gridTraverser.MoveNext()) { if (gridTraverser.Current == this.RowInfo) { this.IsOdd = flag2; break; } flag2 = !flag2; } } else { this.IsOdd = this.RowInfo.Index % 2 == 1; } this.isAlternatingRowColorSet = this.BackColor == this.TableElement.AlternatingRowColor; if (this.CanApplyAlternatingColor && this.IsOdd && this.MasterTemplate != null && (this.MasterTemplate.SelectionMode == GridViewSelectionMode.CellSelect || !this.IsCurrent && !this.IsSelected)) { flag1 = true; } } else { this.IsOdd = false; } if (this.isAlternatingRowColorSet == flag1) { return; } this.isAlternatingRowColorSet = flag1; this.NotifyAlternatingRowChange(); }
internal static GridViewRowInfo NavigateAfterRemove( GridViewRowInfo startFrom, List <GridViewRowInfo> notAllowedRows) { GridViewRowInfo row = startFrom; GridTraverser gridTraverser = new GridTraverser(row.ViewInfo); gridTraverser.GoToRow(row); GridTraverser.GridTraverserPosition position = gridTraverser.Position; GridViewRowInfo newCurrentRowInfo = GridViewRowCollection.ChangeTheChildViewAfterRemove(startFrom); if (newCurrentRowInfo != null) { return(newCurrentRowInfo); } while (gridTraverser.MoveNext()) { if (gridTraverser.Current.CanBeCurrent && (notAllowedRows == null || !notAllowedRows.Contains(gridTraverser.Current))) { if (gridTraverser.Current is GridViewGroupRowInfo) { if (!gridTraverser.Current.IsExpanded) { gridTraverser.Current.IsExpanded = true; } } else { if (gridTraverser.Current is GridViewDataRowInfo || gridTraverser.Current is GridViewNewRowInfo) { newCurrentRowInfo = gridTraverser.Current; break; } break; } } } if (newCurrentRowInfo == null) { gridTraverser.Position = position; gridTraverser.ProcessHierarchy = true; while (gridTraverser.MovePrevious()) { if (gridTraverser.Current.CanBeCurrent && (notAllowedRows == null || !notAllowedRows.Contains(gridTraverser.Current))) { if (gridTraverser.Current is GridViewGroupRowInfo) { if (!gridTraverser.Current.IsExpanded) { gridTraverser.Current.IsExpanded = true; gridTraverser.Position = position; } } else { if (gridTraverser.Current is GridViewDataRowInfo || gridTraverser.Current is GridViewNewRowInfo) { newCurrentRowInfo = gridTraverser.Current; break; } position = gridTraverser.Position; } } } } if (newCurrentRowInfo == null) { return((GridViewRowInfo)null); } if (GridViewRowCollection.HasDeletedParentRow(newCurrentRowInfo, notAllowedRows)) { newCurrentRowInfo = GridViewRowCollection.NavigateAfterRemove(newCurrentRowInfo.Parent as GridViewRowInfo, notAllowedRows); } return(newCurrentRowInfo); }
protected GridViewRowInfo GetLastScrollableRow(GridTableElement tableElement) { ScrollableRowsContainerElement scrollableRows = tableElement.ViewElement.ScrollableRows; GridTraverser enumerator = (GridTraverser)((IEnumerable)tableElement.RowScroller).GetEnumerator(); int index = 0; while (index < scrollableRows.Children.Count && (scrollableRows.Children[index].BoundingRectangle.Bottom <= scrollableRows.Size.Height && enumerator.MoveNext())) { ++index; } return(enumerator.Current); }