Version

GroupByMode Property

Gets/sets the setting which determines how the values in this column will be grouped when using the 'OutlookGroupBy' setting for UltraGridLayout.ViewStyleBand.
Syntax
'Declaration
 
Public Property GroupByMode As GroupByMode
public GroupByMode GroupByMode {get; set;}
Remarks

This property is of type GroupByMode. Not all of the available settings make sense for all columns. The settings that relate to dates and times should only be used with columns whose DataType is System.DateTime. If this property is set to a value which does not make sense for the DataType of the column, the groupings will based on a "dummy" default value whenever possible.

To enable the funtionality for grouping rows, set the Layout's UltraGridLayout.ViewStyleBand property to OutlookGroupBy. This will display a group-by box on the top of the grid where the user can drag and drop a column to group rows by that column. To group rows by a column in code, add the column to the UltraGridBand.SortedColumns collection and specify true for the groupBy parameter of the Add method.

Example
This snippet demonstrates how to use the GroupByMode and SortComparisonType properties.

Private Sub SetupGrid()
   ' If the user groups by the Orders column then the groupings should be built like they are when
   ' a DateTime column is grouped in Microsoft Outlook 2003.
   '
   Me.ultraGrid1.DisplayLayout.Bands("Orders").Columns("DateReceived").GroupByMode = GroupByMode.OutlookDate
   
   ' If the user groups by the LastName column then the groupings should be based on only the first letter
   ' of the customer's last name.
   '
   Me.ultraGrid1.DisplayLayout.Bands("Customers").Columns("LastName").GroupByMode = GroupByMode.FirstCharacter
   
   ' The LastName column should not use case sensitive comparisons when sorting/grouping.
   '
   Me.ultraGrid1.DisplayLayout.Bands("Customers").Columns("LastName").SortComparisonType = SortComparisonType.CaseInsensitive
   
   ' The rest of the text columns should use case-sensitive sorts.  This is the default behavior.
   '
   Me.ultraGrid1.DisplayLayout.Override.SortComparisonType = SortComparisonType.CaseSensitive
End Sub
private void SetupGrid()
{
	// If the user groups by the Orders column then the groupings should be built like they are when
	// a DateTime column is grouped in Microsoft Outlook 2003.
	//
	this.ultraGrid1.DisplayLayout.Bands["Orders"].Columns["DateReceived"].GroupByMode = GroupByMode.OutlookDate;

	// If the user groups by the LastName column then the groupings should be based on only the first letter
	// of the customer's last name.
	//
	this.ultraGrid1.DisplayLayout.Bands["Customers"].Columns["LastName"].GroupByMode = GroupByMode.FirstCharacter;

	// The LastName column should not use case sensitive comparisons when sorting/grouping.
	//
	this.ultraGrid1.DisplayLayout.Bands["Customers"].Columns["LastName"].SortComparisonType = SortComparisonType.CaseInsensitive;

	// The rest of the text columns should use case-sensitive sorts.  This is the default behavior.
	//
	this.ultraGrid1.DisplayLayout.Override.SortComparisonType = SortComparisonType.CaseSensitive;
}
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