Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Expand]Grid View
   [Expand]View Technology
   [Collapse]Grouping
     Grouping Overview
     Grouping Modes and Custom Grouping
     Tutorial: Custom Grouping Algorithms
     Tutorial: Group Row API
     Tutorial: Grouping Basics
     Process Group Rows
     Applying Styles to Group Rows
     Member Table: Grouping
     Member Table: Group Row API and Behavior
     Member Table: Group Summaries
     Member Table: Size, Style, Appearance and Animation
     Member Table: Grouping Modes and Custom Grouping
   [Expand]Sorting
   [Expand]Summaries
   [Expand]Data Editing
   [Expand]Filtering and Locating Rows
   [Expand]Focus and Selection Handling
   [Expand]Processing Rows
   [Expand]Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
   [Expand]Batch Modifications
   [Expand]Hit Information
   [Expand]Hints
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Applying Styles to Group Rows

This document demonstrates how you can customize the appearance of group rows that reside at different group levels. For information on appearance technology, refer to the Appearances Overview topic.

Expanded Applying Styles to Group Rows

In grouped mode, group rows are used to combine rows with identical values in grouping columns. By default, all group rows are painted using the appearance settings provided by the GridViewAppearances.GroupRow property.

Group rows form a tree. The nesting levels (group levels) at which group rows reside, are associated with corresponding grouping columns. Group levels for a sample Grid View are shown in the image below.

To provide different appearances for group rows depending upon their nesting level, the GridView.GroupLevelStyle event can be handled. If the appearances of individual group rows need to be specified, you can handle the GridView.RowStyle or GridView.CustomDrawGroupRow event. The latter also gives you the ability to perform complex painting of group rows.

The GridView.GroupLevelStyle event is fired in turn for each group of rows. The nesting level of the currently processed group can be obtained via the GroupLevelStyleEventArgs.Level parameter.

To change the appearance settings of the group rows via this event, modify the event's GroupLevelStyleEventArgs.LevelAppearance parameter.

 

The following example demonstrates how to supply styles to group rows that match the styles used to paint corresponding group column headers. The appearances of specific columns are customized in the form's Load event.

In the GridView.GroupLevelStyle event's handler, the grouping column that corresponds to the currently processed group level is identified. Then the column header's appearance is combined with group rows' appearances via the AppearanceObject.Combine method.

The result of the customization is illustrated below. The View's BaseView.PaintStyleName property is set to "UltraFlat":

Expanded See Also

How would you rate this topic?​​​​​​​