'Declaration Public Event InitializeRow As InitializeRowEventHandler
public event InitializeRowEventHandler InitializeRow
The event handler receives an argument of type InitializeRowEventArgs containing data related to this event. The following InitializeRowEventArgs properties provide information specific to this event.
Property | Description |
---|---|
ReInitialize | True if the row has already been initialized (read-only) |
Row | The row being initialized (read-only) |
The InitializeRowEventArgs.Row argument returns a reference to an UltraGridRow object that can be used to set properties of, and invoke methods on, the row being displayed. You can use this reference to access any of the returned row's properties or methods.
The InitializeRowEventArgs.ReInitialize argument can be used to determine if the row is being initialized for the first time, such as when the UltraDropDown is initially loading data, or whether it is being reinitialized, such as when the RowsCollection.Refresh method is called.
This event provides an opportunity to perform actions on the row after it is created, such as populating an unbound cell or changing a cell's color based on its value.
When is the InitializeRow event raised?
- Once for each row after it is initially created. In this case, e.ReInitialize is False.
- Once for each cell value, bound or unbound, that changes in each row. In this case, e.ReInitialize is True. Note: This event will NOT be raised recursively if cell values are changed by logic within the event handler itself.
- Once for each row when the WinGrid's Rows.Refresh method is called with the FireInitializeRow parameter. In this case, e.ReInitialize is True.
- Note: When you print or export the grid, the rows are cloned, so InitializeRow will be raised for each of the newly-cloned rows, with e.ReInitialize = False.
The UltraGridLayout.ViewStyle and UltraGridLayout.ViewStyleBand properties of the UltraGridBase.DisplayLayout object are read-only in this event procedure.
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Imports System.Diagnostics Private Sub UltraGrid1_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles ultraGrid1.InitializeRow ' ReInitialize indicates whether the row is being initialized for the first time ' or it's being re-initialized. If e.ReInitialize Then Debug.WriteLine("A row is being re-initilaized.") Else Debug.WriteLine("A row is being initilaized.") End If Dim band As UltraGridBand = Me.ultraGrid1.DisplayLayout.Bands(0) ' Check to see if the row is from band 0. ' If e.Row.Band Is Me.ultraGrid1.DisplayLayout.Bands(0) Then ' Create a custom description that we want shown in the row's ' row preview area. Dim description As System.Text.StringBuilder = New System.Text.StringBuilder() description.Append(e.Row.GetCellText(band.Columns("ContactName"))) description.Append(vbCrLf) description.Append(e.Row.GetCellText(band.Columns("City"))) description.Append(", ") description.Append(e.Row.GetCellText(band.Columns("Country"))) ' Set the row's Description to our custom description text. e.Row.Description = description.ToString() End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { // ReInitialize indicates whether the row is being initialized for the first time // or it's being re-initialized. if ( e.ReInitialize ) Debug.WriteLine( "A row is being re-initilaized." ); else Debug.WriteLine( "A row is being initilaized." ); UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0]; // Check to see if the row is from band 0. // if ( e.Row.Band == this.ultraGrid1.DisplayLayout.Bands[0] ) { // Create a custom description that we want shown in the row's // row preview area. System.Text.StringBuilder description = new System.Text.StringBuilder( ); description.Append( e.Row.GetCellText( band.Columns["ContactName"] ) ); description.Append( "\n" ); description.Append( e.Row.GetCellText( band.Columns["City"] ) ); description.Append( ", " ); description.Append( e.Row.GetCellText( band.Columns["Country"] ) ); // Set the row's Description to our custom description text. e.Row.Description = description.ToString( ); } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2