public bool ExpandRow(int rowIndex) { if (this.childViewInfos.ContainsKey(rowIndex) && this.childViewInfos[rowIndex].IsExpanded) { return(false); } VirtualGridViewInfo childViewInfo = this.GetChildViewInfo(rowIndex, true); VirtualGridRowExpandingEventArgs args = new VirtualGridRowExpandingEventArgs(rowIndex, childViewInfo, this); this.GridElement.OnRowExpanding(args); if (args.Cancel) { return(false); } if (!this.childViewInfos.ContainsKey(rowIndex)) { this.childViewInfos.Add(rowIndex, new VirtualGridViewInfo(this, rowIndex)); } this.childViewInfos[rowIndex].IsExpanded = true; int size = this.GridElement.UseScrollbarsInHierarchy ? this.childViewInfos[rowIndex].ExpandedHeight : this.childViewInfos[rowIndex].GetTotalRowHeight(); this.rowsViewState.SetExpandedSize(rowIndex, size); this.childViewInfos[rowIndex].ExpandedHeight = size; this.OnNotifyPropertyChanged("ExpandedRows[]"); this.GridElement.OnRowExpanded(new VirtualGridRowExpandedEventArgs(rowIndex, childViewInfo, this)); return(true); }
public bool CollapseRow(int rowIndex) { VirtualGridViewInfo childViewInfo = this.GetChildViewInfo(rowIndex, true); VirtualGridRowExpandingEventArgs args = new VirtualGridRowExpandingEventArgs(rowIndex, childViewInfo, this); this.GridElement.OnRowCollapsing(args); if (args.Cancel || !this.childViewInfos.ContainsKey(rowIndex) || !this.childViewInfos[rowIndex].IsExpanded) { return(false); } this.childViewInfos[rowIndex].IsExpanded = false; this.rowsViewState.ResetExpandedSize(rowIndex); this.OnNotifyPropertyChanged("ExpandedRows[]"); this.GridElement.OnRowCollapsed(new VirtualGridRowExpandedEventArgs(rowIndex, childViewInfo, this)); return(true); }
private void radVirtualGrid1_RowExpanding(object sender, Telerik.WinControls.UI.VirtualGridRowExpandingEventArgs e) { if (viewInfoToExpand == null) { e.Cancel = true; e.ViewInfo.StartRowWaiting(e.RowIndex); viewInfoToExpand = e.ViewInfo; rowToExpand = e.RowIndex; expandTimer.Start(); } else { if (rowToExpand != e.RowIndex) { e.Cancel = true; } else { if (e.ChildViewInfo.HierarchyLevel == 2) { e.ChildViewInfo.ColumnCount = DetailsWorkerInProjects.FieldNames.Length; e.ChildViewInfo.RowCount = treeTables[e.ViewInfo.ParentRowIndex].DetailsWorkerInProjects.Count; } // else if (e.ChildViewInfo.HierarchyLevel == 1) { e.ChildViewInfo.ColumnCount = 4; e.ChildViewInfo.RowCount = 3; } else if (e.ChildViewInfo.HierarchyLevel == 3) { e.ChildViewInfo.ColumnCount = 2; e.ChildViewInfo.RowCount = 3; } else { e.ChildViewInfo.ColumnCount = 0; e.ChildViewInfo.RowCount = 0; } } } }