Version

InitializeGroupByRow Event

Occurs when a GroupBy row is initialized.
Syntax
'Declaration
 
Public Event InitializeGroupByRow As InitializeGroupByRowEventHandler
public event InitializeGroupByRowEventHandler InitializeGroupByRow
Event Data

The event handler receives an argument of type InitializeGroupByRowEventArgs containing data related to this event. The following InitializeGroupByRowEventArgs properties provide information specific to this event.

PropertyDescription
ReInitialize True if the row has already been initialized (read-only)
Row The group by row being initialized (read-only)
Remarks

When a band is in GroupBy mode, the user sees rows of data grouped together under GroupBy rows, which serve as temporary headers for the group of rows. GroupBy rows have their own attributes which can be manipulated through code using the UltraGridGroupByRow object. The GroupByRowInitialize event occurs whenever one of these GroupBy rows is created, giving you the chance to work with the GroupBy row before it is displayed.

Example
Following code shows some of the information available in InitializeGroupByRow event and its potential uses. It sets the appearance of the group-by rows based on number of items they contain.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub UltraGrid1_InitializeGroupByRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeGroupByRowEventArgs) Handles ultraGrid1.InitializeGroupByRow

       ' 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 group-by row is being re-initilaized.")
       Else
           Debug.WriteLine("A group-by row is being initilaized.")
       End If

       ' Set the description to desired value. This is the text that shows up on
       ' the group-by row.
       e.Row.Description = e.Row.Value.ToString() & ", " & e.Row.Rows.Count & " Items."

       ' We only want to do this if we are grouping by the Country column.
       If e.Row.Column.Key = "Country" Then
           ' If the group has more than 5 items, then make the background color 
           ' of the row to red
           If e.Row.Rows.Count > 5 Then
               e.Row.Appearance.BackColor = Color.Red
           Else
               e.Row.Appearance.ResetBackColor()
           End If
       End If

   End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void ultraGrid1_InitializeGroupByRow(object sender, Infragistics.Win.UltraWinGrid.InitializeGroupByRowEventArgs 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 group-by row is being re-initilaized." );
	else
		Debug.WriteLine( "A group-by row is being initilaized." );

	// Set the description to desired value. This is the text that shows up on
	// the group-by row.
	e.Row.Description = e.Row.Value.ToString( ) + ", " + e.Row.Rows.Count + " Items.";

	// We only want to do this if we are grouping by the Country column.
	if ( e.Row.Column.Key == "Country" )
	{
		// If the group has more than 5 items, then make the background color 
		// of the row to red
		if ( e.Row.Rows.Count > 5 )
		{
			e.Row.Appearance.BackColor = Color.Red;
		}
		else
		{
			e.Row.Appearance.ResetBackColor( );
		}
	}

}
Requirements

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

See Also