'Declaration Public ReadOnly Property GroupHeaders As GroupHeader()
public GroupHeader[] GroupHeaders {get;}
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub UltraGrid1_BeforeGroupPosChanged(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeGroupPosChangedEventArgs) Handles ultraGrid1.BeforeGroupPosChanged ' BeforeGroupPosChanged gets fired when the user moves, swaps or resizes a group ' or groups. This event gives a chance to cancel the user action. If PosChanged.Moved = e.PosChanged Then ' One or more groups are being moved Dim groupList As String = "" Dim i As Integer For i = 0 To e.GroupHeaders.Length - 1 If i > 0 Then groupList = groupList & ", " groupList = groupList + e.GroupHeaders(i).Caption Next Dim result As DialogResult = MessageBox.Show( _ "You are about to move " & groupList & " groups. Do you want to continue ?", _ "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If DialogResult.No = result Then ' Cancel the move by setting Cancel off the event args. e.Cancel = True End If ElseIf PosChanged.Swapped = e.PosChanged Then ' Two groups are being swapped. Dim result As DialogResult = MessageBox.Show( _ "You are about to swap " & e.GroupHeaders(0).Caption & " with " _ & e.GroupHeaders(1).Caption & " Do you want to continue ?", _ "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If DialogResult.No = result Then ' Cancel the move by setting Cancel off the event args. e.Cancel = True End If ElseIf PosChanged.Sized = e.PosChanged Then ' A group is bieng resized. ' When a group is being resized, e.GroupHeaders contains the group header that's ' being resized. Debug.WriteLine("User is about to resize " & e.GroupHeaders(0).Caption & " group.") End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void ultraGrid1_BeforeGroupPosChanged(object sender, Infragistics.Win.UltraWinGrid.BeforeGroupPosChangedEventArgs e) { // BeforeGroupPosChanged gets fired when the user moves, swaps or resizes a group // or groups. This event gives a chance to cancel the user action. if ( PosChanged.Moved == e.PosChanged ) { // One or more groups are being moved string groupList = ""; for ( int i = 0; i < e.GroupHeaders.Length; i++ ) { if ( i > 0 ) groupList = groupList + ", "; groupList = groupList + e.GroupHeaders[i].Caption; } DialogResult result = MessageBox.Show( "You are about to move " + groupList + " groups. Do you want to continue ?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question ); if ( DialogResult.No == result ) { // Cancel the move by setting Cancel off the event args. e.Cancel = true; } } else if ( PosChanged.Swapped == e.PosChanged ) { // Two groups are being swapped. DialogResult result = MessageBox.Show( "You are about to swap " + e.GroupHeaders[0].Caption + " with " + e.GroupHeaders[1].Caption + " Do you want to continue ?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question ); if ( DialogResult.No == result ) { // Cancel the move by setting Cancel off the event args. e.Cancel = true; } } else if ( PosChanged.Sized == e.PosChanged ) { // A group is bieng resized. // When a group is being resized, e.GroupHeaders contains the group header that's // being resized. Debug.WriteLine( "User is about to resize " + e.GroupHeaders[0].Caption + " group." ); } }
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