protected internal ICollectionView <GridViewRowInfo> LoadHierarchicalData( GridViewHierarchyRowInfo parent, ICollectionView <GridViewRowInfo> sourceView) { if (this.ViewTemplate.HierarchyDataProvider == null) { this.childRows = GridViewChildRowCollection.Empty; this.version = this.ownerTemplate.DataView.Version; return((ICollectionView <GridViewRowInfo>)null); } IList <GridViewRowInfo> childRows = this.ViewTemplate.HierarchyDataProvider.GetChildRows((GridViewRowInfo)parent, this); for (int index = 0; index < childRows.Count; ++index) { childRows[index].ViewInfo = this; childRows[index].SetParent((GridViewRowInfo)parent); } if (sourceView == null || this.ViewTemplate.IsSelfReference) { Dictionary <string, bool> dictionary = new Dictionary <string, bool>(); if (sourceView != null) { for (int index = 0; index < sourceView.Groups.Count; ++index) { DataGroup group = sourceView.Groups[index] as DataGroup; string header = group.Header; if (string.IsNullOrEmpty(header)) { header = index.ToString(); } dictionary.Add(header, group.IsExpanded); } } sourceView = (ICollectionView <GridViewRowInfo>) new SnapshotCollectionView <GridViewRowInfo>((IEnumerable <GridViewRowInfo>)childRows, this.ownerTemplate.DataView); if (this.ownerTemplate.GroupPredicate != null) { ((SnapshotCollectionView <GridViewRowInfo>)sourceView).GroupPredicate = this.ownerTemplate.GroupPredicate; } for (int index = 0; index < sourceView.Groups.Count; ++index) { DataGroup group = sourceView.Groups[index] as DataGroup; string header = group.Header; if (string.IsNullOrEmpty(header)) { header = index.ToString(); } if (dictionary.ContainsKey(header)) { group.GroupRow.IsExpanded = dictionary[header]; } } } else { ((SnapshotCollectionView <GridViewRowInfo>)sourceView).Load((IEnumerable <GridViewRowInfo>)childRows); } return(sourceView); }
public GridViewInfo(GridViewTemplate ownerTemplate) { this.ownerTemplate = ownerTemplate; this.pinnedRows = new GridViewPinnedRowCollection(this); this.summaryRows = new GridViewSummaryRowCollection((IList <GridViewSummaryRowInfo>) new List <GridViewSummaryRowInfo>()); this.systemRows = new GridViewSystemRowCollection(this); this.childRows = new GridViewChildRowCollection(); this.ownerTemplate.PropertyChanged += new PropertyChangedEventHandler(this.OnTemplatePropertyChanged); }
public GridViewGroupRowInfo(GridViewInfo gridViewInfo, DataGroup dataGroup) : base(gridViewInfo) { this.topSummaryRowSource = new List <GridViewSummaryRowInfo>(); this.topSummaryRows = new GridViewSummaryRowCollection((IList <GridViewSummaryRowInfo>) this.topSummaryRowSource); this.bottomSummaryRowSource = new List <GridViewSummaryRowInfo>(); this.bottomSummaryRows = new GridViewSummaryRowCollection((IList <GridViewSummaryRowInfo>) this.bottomSummaryRowSource); this.ownerGroup = dataGroup; this.childRows = new GridViewChildRowCollection(); }