'宣言 Public ReadOnly Default Property Item( _ ByVal index As Integer _ ) As UltraDataRow
public UltraDataRow this[ int index ]; {get;}
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinDataSource Imports Infragistics.Win.UltraWinGrid Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.UltraGrid1.DataSource = Me.UltraDataSource1 ' Add two columns to the root band. Me.UltraDataSource1.Band.Columns.Add("Col0", GetType(String)) Me.UltraDataSource1.Band.Columns.Add("Col1", GetType(String)) ' Add a child band to the root band with the key of "ChildBand". Dim childBand As UltraDataBand = Me.UltraDataSource1.Band.ChildBands.Add("ChildBand") ' Add two columns to the child band. childBand.Columns.Add("ChildCol0", GetType(String)) childBand.Columns.Add("ChildCol1", GetType(String)) ' Set the count on the root rows collection to 2. Me.UltraDataSource1.Rows.SetCount(2) Dim row As UltraDataRow ' Initialize rows with data. 'Get the first row. row = Me.UltraDataSource1.Rows(0) row("Col0") = "Row 0, Col 0" row("Col1") = "Row 0, Col 1" ' Initialize the child rows of the row. Dim childRows As UltraDataRowsCollection = row.GetChildRows("ChildBand") childRows.SetCount(2) childRows(0)("ChildCol0") = "Child Row 0, ChildCol 0" childRows(0)("ChildCol1") = "Child Row 0, ChildCol 1" childRows(1)("ChildCol0") = "Child Row 1, ChildCol 0" childRows(1)("ChildCol1") = "Child Row 1, ChildCol 1" ' Get the second row. row = Me.UltraDataSource1.Rows(1) row("Col0") = "Row 1, Col 0" row("Col1") = "Row 1, Col 1" ' Initialize the child rows of the row. childRows = row.GetChildRows("ChildBand") childRows.SetCount(1) End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinDataSource; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void Form1_Load(object sender, System.EventArgs e) { this.ultraGrid1.DataSource = this.ultraDataSource1; // Add two columns to the root band. this.ultraDataSource1.Band.Columns.Add( "Col0", typeof( string ) ); this.ultraDataSource1.Band.Columns.Add( "Col1", typeof( string ) ); // Add a child band to the root band with the key of "ChildBand". UltraDataBand childBand = this.ultraDataSource1.Band.ChildBands.Add( "ChildBand" ); // Add two columns to the child band. childBand.Columns.Add( "ChildCol0", typeof( string ) ); childBand.Columns.Add( "ChildCol1", typeof( string ) ); // Set the count on the root rows collection to 2. this.ultraDataSource1.Rows.SetCount( 2 ); UltraDataRow row; // Initialize rows with data. //Get the first row. row = this.ultraDataSource1.Rows[0]; row[ "Col0" ] = "Row 0, Col 0"; row[ "Col1" ] = "Row 0, Col 1"; // Initialize the child rows of the row. UltraDataRowsCollection childRows = row.GetChildRows( "ChildBand" ); childRows.SetCount( 2 ); childRows[0][ "ChildCol0" ] = "Child Row 0, ChildCol 0"; childRows[0][ "ChildCol1" ] = "Child Row 0, ChildCol 1"; childRows[1][ "ChildCol0" ] = "Child Row 1, ChildCol 0"; childRows[1][ "ChildCol1" ] = "Child Row 1, ChildCol 1"; // Get the second row. row = this.ultraDataSource1.Rows[1]; row[ "Col0" ] = "Row 1, Col 0"; row[ "Col1" ] = "Row 1, Col 1"; // Initialize the child rows of the row. childRows = row.GetChildRows( "ChildBand" ); childRows.SetCount( 1 ); }