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

sender
e
delegate for after a group has been moved, sized or swapped

Syntax

Visual Basic (Declaration) 
Public Delegate Sub AfterGroupPosChangedEventHandler( _
   ByVal sender As Object, _
   ByVal e As AfterGroupPosChangedEventArgs _
) 
C# 
public delegate void AfterGroupPosChangedEventHandler( 
   object sender,
   AfterGroupPosChangedEventArgs e
)

Parameters

sender
e

Example

Following code shows some of the information available in AfterGroupPosChanged event.

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_AfterGroupPosChanged(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.AfterGroupPosChangedEventArgs) Handles ultraGrid1.AfterGroupPosChanged

       ' AfterGroupPosChanged gets fired after the user has moved, swapped or resized a group
       ' or groups.

       If PosChanged.Moved = e.PosChanged Then
           ' One or more groups have been moved

           Debug.WriteLine("Following are the new positions of the groups:")

           Dim i As Integer
           For i = 0 To e.GroupHeaders.Length - 1
               Debug.WriteLine("    " & e.GroupHeaders(i).Caption & " is moved to the new visible index of " & e.GroupHeaders(i).VisiblePosition)
           Next
       ElseIf PosChanged.Swapped = e.PosChanged Then
           ' Two groups have been swapped.

           Debug.WriteLine(e.GroupHeaders(0).Caption & " and " & e.GroupHeaders(1).Caption & " groups have been swapped.")
       ElseIf PosChanged.Sized = e.PosChanged Then
           ' A group has been resized.

           Debug.WriteLine(e.GroupHeaders(0).Caption & " has been resized to the new width of " & e.GroupHeaders(0).Caption)
       End If

   End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void ultraGrid1_AfterGroupPosChanged(object sender, Infragistics.Win.UltraWinGrid.AfterGroupPosChangedEventArgs e)
{

	// AfterGroupPosChanged gets fired after the user has moved, swapped or resized a group
	// or groups.
	
	if ( PosChanged.Moved == e.PosChanged )
	{	
		// One or more groups have been moved

		Debug.WriteLine( "Following are the new positions of the groups:" );

		for ( int i = 0; i < e.GroupHeaders.Length; i++ )
		{										
			Debug.WriteLine( "    " + e.GroupHeaders[i].Caption + 
				" is moved to the new visible index of " + e.GroupHeaders[i].VisiblePosition );
		}
	}
	else if ( PosChanged.Swapped == e.PosChanged )
	{
		// Two groups have been swapped.

		Debug.WriteLine( e.GroupHeaders[0].Caption + " and " + e.GroupHeaders[1].Caption 
			+ " groups have been swapped." );
	}
	else if ( PosChanged.Sized == e.PosChanged )
	{
		// A group has been resized.

		Debug.WriteLine( e.GroupHeaders[0].Caption + 
			" has been resized to the new width of " + e.GroupHeaders[0].Caption );
	}

}

See Also