Infragistics(R) NetAdvantage(R) Windows Forms
InitializeGroupByRowEventArgs Class
Members  Example  See Also  E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace : InitializeGroupByRowEventArgs Class

Event parameters used the InitializeRow event.

Syntax

Visual Basic (Declaration) 
Public Class InitializeGroupByRowEventArgs 
   Inherits System.EventArgs
C# 
public class InitializeGroupByRowEventArgs : System.EventArgs 

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.

Visual BasicCopy Code
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
C#Copy Code
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( );
		}
	}

}

See Also