protected virtual void UpdateOnViewInfoChanged() { if (this.rowScroller != null) { this.rowScroller.Dispose(); } this.rowScroller = new VirtualGridItemScroller(this.RowsViewState); this.rowScroller.ElementProvider = (IVirtualizedElementProvider <int>) new VirtualRowsElementProvider(this); this.rowScroller.ItemHeight = this.RowHeight; this.rowScroller.ItemSpacing = this.RowSpacing; this.rowScroller.ScrollMode = ItemScrollerScrollModes.Smooth; this.rowScroller.Scrollbar = this.VScrollBar; this.rowScroller.Traverser = (ITraverser <int>) new VirtualGridTraverser(this.RowsViewState); this.rowScroller.UpdateScrollRange(); this.rowScroller.ScrollerUpdated += new EventHandler(this.rowScroller_ScrollerUpdated); if (this.columnScroller != null) { this.columnScroller.Dispose(); } this.columnScroller = new VirtualGridItemScroller(this.ColumnsViewState); this.columnScroller.ElementProvider = (IVirtualizedElementProvider <int>) new VirtualCellsElementProvider(this); this.columnScroller.ItemHeight = this.ColumnWidth; this.columnScroller.ItemSpacing = this.CellSpacing; this.columnScroller.ScrollMode = ItemScrollerScrollModes.Smooth; this.columnScroller.Scrollbar = this.HScrollBar; this.columnScroller.Traverser = (ITraverser <int>) new VirtualGridTraverser(this.ColumnsViewState); this.columnScroller.UpdateScrollRange(); this.columnScroller.ScrollerUpdated += new EventHandler(this.columnScroller_ScrollerUpdated); this.ViewElement.TableElement = this; if (this.pagingPanel != null) { this.pagingPanel.Dispose(); this.pagingPanel = (VirtualGridPagingPanelElement)null; } if (this.ViewInfo.EnablePaging) { this.pagingPanel = new VirtualGridPagingPanelElement(this, this.ViewInfo); this.pagingPanel.UpdateView(); this.Children.Add((RadElement)this.pagingPanel); } if (this.waitingElement == null) { this.waitingElement = new VirtualGridWaitingElement(); this.waitingElement.Visibility = ElementVisibility.Collapsed; this.Children.Add((RadElement)this.waitingElement); } this.SetScrollState(); if (this.ViewInfo.IsWaiting) { this.waitingElement.StartWaiting(); this.InvalidateMeasure(); } else { this.waitingElement.StopWaiting(); this.InvalidateMeasure(); } this.RowScroller.UpdateScrollRange(); this.ColumnScroller.UpdateScrollRange(); this.InvalidatePinnedRows(); this.InvalidateMeasure(true); this.UpdateNoDataText(); }
protected virtual void OnViewInfoPropertyChanged(object sender, PropertyChangedEventArgs e) { if (this.IsDisposed || this.IsDisposing) { return; } bool flag = e.PropertyName == "ColumnSizes[]" || e.PropertyName == "ColumnWidth"; if (e.PropertyName == "RowCount" || e.PropertyName == "RowHeight" || (e.PropertyName == "RowSpacing" || e.PropertyName == "RowSizes[]")) { this.ViewElement.UpdateElementSpacing(); if (this.RowScroller != null) { this.RowScroller.ItemSpacing = this.ViewInfo.RowSpacing; this.RowScroller.UpdateScrollRange(); } this.UpdateNoDataText(); if (this.GridElement != null && this.GridElement.EnablePaging && this.ViewInfo.ParentViewInfo == null) { this.PagingPanelElement.UpdateView(); } } else if (e.PropertyName == "ColumnCount" || e.PropertyName == "ColumnWidth" || (e.PropertyName == "CellSpacing" || flag)) { this.ViewElement.UpdateElementSpacing(); if (flag) { this.SynchronizeRows(false, false); } else { this.SynchronizeRows(false); } this.ColumnScroller.ItemSpacing = this.ViewInfo.CellSpacing; this.ColumnScroller.UpdateScrollRange(); this.UpdateNoDataText(); } else if (e.PropertyName == "TopPinnedRows[]" || e.PropertyName == "BottomPinnedRows[]" || (e.PropertyName == "ShowFilterRow" || e.PropertyName == "ShowHeaderRow") || e.PropertyName == "ShowNewRow") { this.InvalidatePinnedRows(); this.InvalidateMeasure(); } else if (e.PropertyName == "LeftPinnedColumns[]" || e.PropertyName == "RightPinnedColumns[]") { foreach (VirtualGridRowElement rowElement in this.ViewElement.GetRowElements()) { rowElement.InvalidatePinnedColumns(); } this.UpdateOnViewInfoChanged(); } else if (e.PropertyName == "WaitingRows[]") { this.SynchronizeRows(); } else if (e.PropertyName == "ColumnDataTypes[]") { if (this.GridElement.AllowFiltering) { foreach (VirtualGridRowElement child in this.ViewElement.TopPinnedRows.Children) { if (child is VirtualGridFilterRowElement) { child.Synchronize(); break; } } } } else if (e.PropertyName == "RowErrorTexts[]") { foreach (VirtualGridRowElement descendant in this.GetDescendants((Predicate <RadElement>)(x => x is VirtualGridRowElement), TreeTraversalMode.BreadthFirst)) { descendant.SynchronizeIndentCell(); } } else if (e.PropertyName == "ExpandedRows[]" || e.PropertyName == "EnableAlternatingRowColor") { for (int index = 0; index < this.ViewElement.ScrollableRows.Children.Count; ++index) { (this.ViewElement.ScrollableRows.Children[index] as VirtualGridRowElement)?.Synchronize(); } } else if (e.PropertyName == "IsWaiting") { if (this.ViewInfo.IsWaiting) { this.waitingElement.StartWaiting(); } else { this.waitingElement.StopWaiting(); this.SynchronizeRows(); } } else if (e.PropertyName == "AllowColumnSort") { foreach (VirtualGridRowElement child in this.ViewElement.TopPinnedRows.Children) { if (child is VirtualGridHeaderRowElement) { child.Synchronize(); } } } else if (e.PropertyName == "EnablePaging") { if (this.ViewInfo.EnablePaging) { if (this.pagingPanel != null) { this.pagingPanel.Dispose(); this.pagingPanel = (VirtualGridPagingPanelElement)null; } this.pagingPanel = new VirtualGridPagingPanelElement(this, this.ViewInfo); this.pagingPanel.UpdateView(); this.Children.Add((RadElement)this.pagingPanel); } else if (this.pagingPanel != null) { this.pagingPanel.Dispose(); this.pagingPanel = (VirtualGridPagingPanelElement)null; } } else if (e.PropertyName == "PageIndex") { if (this.ViewInfo.EnablePaging && this.pagingPanel != null) { this.pagingPanel.UpdateView(); this.RowScroller.UpdateScrollRange(); } } else if (e.PropertyName == "PageSize") { if (this.pagingPanel != null) { this.pagingPanel.UpdateView(); } this.RowScroller.UpdateScrollRange(); } else if (e.PropertyName == "VerticalScrollState" || e.PropertyName == "HorizontalScrollState") { this.SetScrollState(); } else if (e.PropertyName == "AutoSizeColumnsMode") { switch (this.ViewInfo.AutoSizeColumnsMode) { case VirtualGridAutoSizeColumnsMode.None: this.ColumnLayout = (BaseVirtualGridColumnLayout) new StandardVirtualGridColumnLayout(); break; case VirtualGridAutoSizeColumnsMode.Fill: this.ColumnLayout = (BaseVirtualGridColumnLayout) new StretchVirtualGridColumnLayout(); break; } } this.InvalidateMeasure(true); if (!flag) { this.UpdateLayout(); } this.GridElement.OnViewInfoPropertyChanged(this.ViewInfo, e.PropertyName); }