Skip to main content

GridView.GroupLevelStyle Event

Enables you to specify custom styles for group rows (and corresponding indents) residing at particular nesting levels.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

[DXCategory("Appearance")]
public event GroupLevelStyleEventHandler GroupLevelStyle

Event Data

The GroupLevelStyle event's data class is GroupLevelStyleEventArgs. The following properties provide information specific to this event:

Property Description
Level Gets the nesting level of group rows whose style is to be specified.
LevelAppearance Gets the appearance settings applied to the group rows located at the current nesting level.

Remarks

Handle the GroupLevelStyle event to provide different styles for group rows and corresponding indents depending on the group row level.

The current grouping level is identified by the GroupLevelStyleEventArgs.Level parameter. Use the GroupLevelStyleEventArgs.LevelAppearance parameter to customize the appearance settings of particular group rows and indents.

Group Level Style - WinForms Data Grid

using System.Drawing;

Dictionary<int, Color> GroupLevelColors = new Dictionary<int, Color>() {
    {0, Color.DarkGray},
    {1, Color.Orange}
};
private void gridView1_GroupLevelStyle(object sender, GroupLevelStyleEventArgs e) {
    e.LevelAppearance.BackColor = e.Level % 2 == 0 ? GroupLevelColors[0] : GroupLevelColors[1];
}

Handle the GridView.CustomDrawGroupRow event to specify styles for individual group rows (or paint each individual group row manually). However, this event does not allow you to customize the appearance of group indents (the regions displayed below group expand buttons when group rows are expanded).

See Also