'宣言 Public ReadOnly Property ParentCollection As UltraDataBandsCollection
public UltraDataBandsCollection ParentCollection {get;}
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinDataSource Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ds As UltraDataSource = New UltraDataSource() Dim rootBand As UltraDataBand = ds.Band rootBand.Columns.Add("Col1", GetType(String)) Dim col1 As UltraDataColumn = rootBand.Columns("Col1") ' Column has a back reference to the band. rootBand = col1.Band ' You can get the column collection a column belongs to using ' ParentCollection property of the column. Dim columnCollection As UltraDataColumnsCollection = col1.ParentCollection ' UltraDataColumnsCollection also has a back reference to the band. ' Following two lines will give you the same band. rootBand = columnCollection.Band rootBand = col1.Band ds.Rows.Add() Dim row As UltraDataRow = ds.Rows(0) ' Row has a back reference to the row collection it belongs to. Dim rowCollection As UltraDataRowsCollection = row.ParentCollection ' Both the UltraDataRow and UltraDataRowsCollection have a back ' reference to the band they belong to. Following two lines will ' get the same bands. (A row collection and rows it contains will ' pont to the same band). rootBand = rowCollection.Band rootBand = row.ParentCollection.Band ' Row collection also has a back reference to the parent row. Dim parentRow As UltraDataRow = rowCollection.ParentRow ' You can also get the parent row from a row. Following two ' lines do the same. parentRow = row.ParentRow parentRow = row.ParentCollection.ParentRow rootBand.ChildBands.Add("ChildBand") Dim childBand As UltraDataBand = rootBand.ChildBands("ChildBand") ' Band has a back reference to the bands collection it belongs to. Dim bandsCollection As UltraDataBandsCollection = childBand.ParentCollection ' Both UltraDataBand and UltraDataBandsCollection have a back reference ' the parent band. Following two lines will give you the same band. rootBand = childBand.ParentBand rootBand = childBand.ParentCollection.ParentBand End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinDataSource; using System.Diagnostics; private void button1_Click(object sender, System.EventArgs e) { UltraDataSource ds = new UltraDataSource( ); UltraDataBand rootBand = ds.Band; rootBand.Columns.Add( "Col1", typeof( string ) ); UltraDataColumn col1 = rootBand.Columns[ "Col1" ]; // Column has a back reference to the band. rootBand = col1.Band; // You can get the column collection a column belongs to using // ParentCollection property of the column. UltraDataColumnsCollection columnCollection = col1.ParentCollection; // UltraDataColumnsCollection also has a back reference to the band. // Following two lines will give you the same band. rootBand = columnCollection.Band; rootBand = col1.Band; ds.Rows.Add( ); UltraDataRow row = ds.Rows[0]; // Row has a back reference to the row collection it belongs to. UltraDataRowsCollection rowCollection = row.ParentCollection; // Both the UltraDataRow and UltraDataRowsCollection have a back // reference to the band they belong to. Following two lines will // get the same bands. (A row collection and rows it contains will // pont to the same band). rootBand = rowCollection.Band; rootBand = row.ParentCollection.Band; // Row collection also has a back reference to the parent row. UltraDataRow parentRow = rowCollection.ParentRow; // You can also get the parent row from a row. Following two // lines do the same. parentRow = row.ParentRow; parentRow = row.ParentCollection.ParentRow; rootBand.ChildBands.Add( "ChildBand" ); UltraDataBand childBand = rootBand.ChildBands["ChildBand"]; // Band has a back reference to the bands collection it belongs to. UltraDataBandsCollection bandsCollection = childBand.ParentCollection; // Both UltraDataBand and UltraDataBandsCollection have a back reference // the parent band. Following two lines will give you the same band. rootBand = childBand.ParentBand; rootBand = childBand.ParentCollection.ParentBand; }