If the band is in Group-By mode, the rows in the band will appear grouped according to the columns added to the SortedColumns collection as group-by columns. The user can add columns to this collection through the grid's UI by dragging column headers into the Group-By box. As columns are added, the rows in the band are dynamically re-grouped. By clearing the contents of the collection, all rows are ungrouped and the GroupBy box is cleared.
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub Button75_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button75.Click ' Following code groups the rows by two columns. ' Ensure view style is set OutlookGroupBy. Me.UltraGrid1.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy ' Group rows in band 0 by two columns. Dim band As UltraGridBand = Me.UltraGrid1.DisplayLayout.Bands(0) band.SortedColumns.Add(band.Columns(0), False, True) band.SortedColumns.Add(band.Columns(1), False, True) End Sub Private Sub Button76_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button76.Click ' Call ClearGroupByColumns to ungroup all the rows in the UltraGrid if they ' were grouped by any columns. Me.UltraGrid1.DisplayLayout.ClearGroupByColumns() ' Or you can clear group-by rows on a specific band. Me.ultraGrid1.DisplayLayout.Bands(0).ClearGroupByColumns() End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button75_Click(object sender, System.EventArgs e) { // Following code groups the rows by two columns. // Ensure view style is set OutlookGroupBy. this.ultraGrid1.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy; // Group rows in band 0 by two columns. UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0]; band.SortedColumns.Add( band.Columns[0], false, true ); band.SortedColumns.Add( band.Columns[1], false, true ); } private void button76_Click(object sender, System.EventArgs e) { // Call ClearGroupByColumns to ungroup all the rows in the UltraGrid if they // were grouped by any columns. this.ultraGrid1.DisplayLayout.ClearGroupByColumns( ); // Or you can clear group-by rows on a specific band. this.ultraGrid1.DisplayLayout.Bands[0].ClearGroupByColumns( ); }
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