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.
' 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
// 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;
' Set the Back color appearance for all Group By Rows
Me.ultraGrid1.DisplayLayout.Bands(0).Override.GroupByRowAppearance.BackColor = Color.Pink
// Set the Back color appearance for all Group By Rows
this.ultraGrid1.DisplayLayout.Bands[0].Override.GroupByRowAppearance.BackColor = Color.Pink;
' 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
// 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;
' 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;
// 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;
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.
' 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
// 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;
}