Version

AfterGroupPosChanged Event

Occurs after an UltraGridGroup object has been moved, sized, or swapped.
Syntax
'Declaration
 
Public Event AfterGroupPosChanged As AfterGroupPosChangedEventHandler
public event AfterGroupPosChangedEventHandler AfterGroupPosChanged
Event Data

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

PropertyDescription
GroupHeaders groups (read-only)
GroupPosChangedType header position changed type (read-only)
Remarks

The action argument indicates which action occurred to the group or groups: moving, swapping, or sizing.

The groups argument returns a reference to a Groups collection that can be used to retrieve references to the UltraGridGroup object or objects that were moved, swapped, or sized. You can use this reference to access any of the returned collection's properties or methods, as well as the properties or methods of the objects within the collection.

This event is generated after one or more groups are moved, swapped, or sized, either programmatically, or by user interaction. A group can be sized programmatically by setting its Width property and can be moved programmatically by setting its header's VisiblePosition property.

The VisiblePosition property of a group's header can be used to determine the new position of a group that was moved or swapped.

To prevent the user from attempting to move or swap a group, set the AllowGroupMoving or AllowGroupSwapping properties, respectively.

The AfterColPosChanged event is generated after one or more columns are moved, swapped, or sized.

The BeforeGroupPosChanged event, which occurs before one or more groups are moved, swapped, or sized, is generated before this event.

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.

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
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 );
	}

}
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