Skip to main content
All docs
V17.2

Category Rows

  • 3 minutes to read

The vertical grid controls (VGridControl and PropertyGridControl) have different types of rows that are described in the Rows Overview topic. This topic deals with the features provided by category rows. It explains when such rows need to be used and how they can be customized.

Category Rows

Category rows don’t display any data cells. These rows are used to arrange editor and multi-editor rows into groups. You might need them if the rows displayed within the vertical grid control can be logically divided into several categories. In this case related rows must be added to the corresponding category row as child rows. End-users can expand/collapse category rows.

The image below shows a VGridControl with expanded and collapsed categories.

CategoryRow - Samples

Note: category rows don’t necessarily reside at the first level within the grid control. They can also be child rows of other rows. You can provide sub-categories within a category. For details on how to implement a hierarchical row structure within a vertical grid, see the Creating a Tree-Like Structure of Rows topic.

Features of Category Rows

The base functionality is inherited from the BaseRow class. The CategoryRow class overrides the BaseRow.Properties property to return a CategoryRowProperties object which provides settings specific to category rows. Since category rows do not display any data cells, you can use these settings only to specify the row’s caption and image. For this purpose, use the RowProperties.Caption and RowProperties.ImageIndex properties, respectively.

The image below illustrates the category row’s settings.

CategoryRow - Settings

To access the settings of specific rows at design time use the Rows Page.

Customizing Category Rows - Runtime Sample

The following sample code shows how to customize the ‘Details’ category’s settings (image, appearance, height). The image below shows the vertical grid control before and after executing the sample code.

CategoryRows - RuntimeSample


using DevExpress.Utils;
using DevExpress.XtraVerticalGrid;
using DevExpress.XtraVerticalGrid.Rows;
// ...

// obtaining the row
CategoryRow row = vGridControl1.Rows["rowDetails"] as CategoryRow;
// modifying the height
row.Height = 30;
// changing the row style
row.Appearance.BackColor = Color.Yellow;
row.Appearance.BackColor2 = Color.Gold;
row.Appearance.Font = new Font("Tahoma", 8, FontStyle.Bold);

// displaying an image within the header
ImageList images = new ImageList();
images.Images.Add(Image.FromFile("e:\\Images\\Icons\\detailsImage.bmp"));
vGridControl1.ImageList = images;
row.Properties.ImageIndex = 0;