Version

Styling Rows and Row Connectors in Outlook Group By Mode

When creating an Outlook Group By grouping in WinGrid™, the area to the left of the expanded groups is known as the GroupByRowConnector. You can style the appearance of the row connectors for the entire control or for specific columns by using the GroupByRowConnectorAppearance property. You can also modify the row connector appearance on the UltraGridGroupByRow itself in order to style the row connectors for certain rows. This is done through the RowConnectorAppearance property. Additionally, you can style Group By rows themselves through the GroupByRowAppearance property.

It is assumed that a WinGrid control bound to the Employees table of the Northwind database is dropped onto the form. Write the following code in the Form load event.

In Visual Basic:

' Enable Outlook Group By
Me.ultraGrid1.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy
' Set the Row Connector back color to Magenta
Me.ultraGrid1.DisplayLayout.Bands(0).Override.GroupByRowConnectorAppearance.BackColor = Color.Magenta

In C#:

// Enable Outlook Group By
this.ultraGrid1.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy;
// Set the Row Connector back color to Magenta
this.ultraGrid1.DisplayLayout.Bands[0].Override.GroupByRowConnectorAppearance.BackColor = Color.Magenta;
WinGrid Styling Rows and Row Connectors in Outlook Group By Mode 01.png

In Visual Basic:

' Set the Back color appearance for all Group By Rows
Me.ultraGrid1.DisplayLayout.Bands(0).Override.GroupByRowAppearance.BackColor = Color.Pink

In C#:

// Set the Back color appearance for all Group By Rows
this.ultraGrid1.DisplayLayout.Bands[0].Override.GroupByRowAppearance.BackColor = Color.Pink;
WinGrid Styling Rows and Row Connectors in Outlook Group By Mode 02.png

In Visual Basic:

' Set the Row Connector Back color to Aqua for rows grouped by the FirstName column
Me.ultraGrid1.DisplayLayout.Bands(0).Columns("FirstName").GroupByRowConnectorAppearance.BackColor = Color.Aqua

In C#:

// Set the Row Connector Back color to Aqua for rows grouped by the FirstName column
this.ultraGrid1.DisplayLayout.Bands[0].Columns["FirstName"].GroupByRowConnectorAppearance.BackColor = Color.Aqua;
WinGrid Styling Rows and Row Connectors in Outlook Group By Mode 03.png

In Visual Basic:

' Set the Back color appearance for Group By rows grouped by the BirthDate column
Me.ultraGrid1.DisplayLayout.Bands[0].Columns["BirthDate"].GroupByRowAppearance.BackColor = Color.BurlyWood;

In C#:

// Set the Back color appearance for Group By rows grouped by the BirthDate column
this.ultraGrid1.DisplayLayout.Bands[0].Columns["BirthDate"].GroupByRowAppearance.BackColor = Color.BurlyWood;
WinGrid Styling Rows and Row Connectors in Outlook Group By Mode 04.png

The following code shows how you can handle the WinGrid control’s InitializeGroupByRow event to style WinGrid. Write the following code within the InitializeGroupByRow event.

In Visual Basic:

' Set Connector appearance only if WinGrid is grouped by the Title column
If e.Row.Column.Header.Caption = “Title”
Then
' Set the color of the row connector area to DarkOliveGreen
    e.Row.RowConnectorAppearance.BackColor = Color.DarkOliveGreen
End If

In C#:

// Set Connector appearance only if WinGrid is grouped by the Title column
 if(e.Row.Column.Header.Caption = “Title”)
{
 // Set the color of the row connector area to DarkOliveGreen
 e.Row.RowConnectorAppearance.BackColor = Color.DarkOliveGreen;
}
WinGrid Styling Rows and Row Connectors in Outlook Group By Mode 05.png

Related Topics