'宣言 Public Overloads Property Item( _ ByVal columnIndex As Integer _ ) As Object
public object Item( int columnIndex ) {get; set;}
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinDataSource Imports Infragistics.Win.UltraWinGrid Private Sub UltraDataSource1_InitializeDataRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinDataSource.InitializeDataRowEventArgs) Handles UltraDataSource1.InitializeDataRow ' InitializeDataRow event is used for initializing rows. It gets fired for ' each row in the data source when the row is created for the first time. Dim row As UltraDataRow = e.Row ' You can use the tag off the row to store some piece of data that ' aids you in identifying the row later on (for example in other ' event handlers like CellDataRequested). row.Tag = New Object() ' You can get the row collection that contains the row using ' ParentCollection property. Dim parentCollection As UltraDataRowsCollection = e.Row.ParentCollection ' You can get the row's index in the parent collection using ' Index property. Dim rowIndex As Integer = row.Index ' You can get the parent row of a row using ParentRow property. ' If row is a top-most row, ParentRow will be null. Dim parentRow As UltraDataRow = row.ParentRow ' You can also see which band the row is associated with. Dim rowBand As UltraDataBand = row.Band ' You can also intialize the cell values here. Dim column As UltraDataColumn For Each column In rowBand.Columns If GetType(String) Is column.DataType Then row(column) = "Test Data" End If Next ' Print out the row index and the band key. System.Diagnostics.Debug.WriteLine("Band key = " & e.Row.Band.Key & "Row Index = " & e.Row.Index) End Sub Private Sub UltraDataSource1_InitializeRowsCollection(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinDataSource.InitializeRowsCollectionEventArgs) Handles UltraDataSource1.InitializeRowsCollection ' InitializeRowsCollection event is used for initializing row collections. ' It gets fired for each row collection in the data source when it's created ' for the first time. Dim parentRow As UltraDataRow = e.Rows.ParentRow ' If the parent row is null then it's the root rows collection. Otherwise ' it's a child row collection of the parent row. If Not Nothing Is parentRow Then ' Here typically you set the count based on the parent row. e.Rows.SetCount(10) End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinDataSource; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void ultraDataSource1_InitializeDataRow(object sender, Infragistics.Win.UltraWinDataSource.InitializeDataRowEventArgs e) { // InitializeDataRow event is used for initializing rows. It gets fired for // each row in the data source when the row is created for the first time. UltraDataRow row = e.Row; // You can use the tag off the row to store some piece of data that // aids you in identifying the row later on (for example in other // event handlers like CellDataRequested). row.Tag = new object( ); // You can get the row collection that contains the row using // ParentCollection property. UltraDataRowsCollection parentCollection = e.Row.ParentCollection; // You can get the row's index in the parent collection using // Index property. int rowIndex = row.Index; // You can get the parent row of a row using ParentRow property. // If row is a top-most row, ParentRow will be null. UltraDataRow parentRow = row.ParentRow; // You can also see which band the row is associated with. UltraDataBand rowBand = row.Band; // You can also intialize the cell values here. foreach ( UltraDataColumn column in rowBand.Columns ) { if ( typeof( string ) == column.DataType ) row[ column ] = "Test Data"; } // Print out the row index and the band key. System.Diagnostics.Debug.WriteLine( "Band key = " + e.Row.Band.Key + "Row Index = " + e.Row.Index ); } private void ultraDataSource1_InitializeRowsCollection(object sender, Infragistics.Win.UltraWinDataSource.InitializeRowsCollectionEventArgs e) { // InitializeRowsCollection event is used for initializing row collections. // It gets fired for each row collection in the data source when it's created // for the first time. UltraDataRow parentRow = e.Rows.ParentRow; // If the parent row is null then it's the root rows collection. Otherwise // it's a child row collection of the parent row. if ( null != parentRow ) { // Here typically you set the count based on the parent row. e.Rows.SetCount( 10 ); } }