Skip to main content

CategoryRow Class

Represents a category row within your grid control.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v24.2.dll

Declaration

public class CategoryRow :
    BaseRow

The following members return CategoryRow objects:

Remarks

The CategoryRow class is used to represent a row of the category type in the VGridControlBase descendants. Rows of this kind do not display any data cell. These rows are used to combine related rows into groups. Related rows can be added to the corresponding category row as children. This enables end-users to expand/collapse category rows at runtime showing and hiding rows belonging to a category.

Being the direct descendant of the BaseRow class, the CategoryRow inherits all its properties and methods. The CategoryRow.XtraRowTypeID property is overridden in the CategoryRow class in order to return a proper numerical expression of the category row type.

This class additionally introduces two overloaded variants of a constructor for editor rows. You can use these constructors to programmatically instantiate a category row either with default settings or with the specified caption.

Example

The example below demonstrates how to create a category row at runtime using the default constructor. The example code adjusts the created row and adds it to a vertical grid’s VGridControlBase.Rows collection. The new category row is intended to contain three existing grid rows (HP, Capacity and MPG) as its child rows. For this purpose, the mentioned rows are moved to the newly created category by using the VGridControlBase.MoveRow method.

The following picture displays the grid’s state before and after execution of the code.

CategoryRow_Ctor

using DevExpress.XtraVerticalGrid.Rows;

// creating a new category row instance
CategoryRow newCategoryRow = new CategoryRow();

// assigning the name and caption to the created category row
newCategoryRow.Name = "categoryRow_Performance";
newCategoryRow.Properties.Caption = "Performance Attributes";

// appending the category row to a collection of top level grid rows
vGridControl1.Rows.Add(newCategoryRow);

// moving the specified grid rows to the category's collection of child rows
BaseRow [] rows = new BaseRow [3] {vGridControl1.Rows["editorRow_HP"], 
  vGridControl1.Rows["editorRow_Liter"],vGridControl1.Rows["multiEditorRow_MPG"]};
foreach(BaseRow row in rows) vGridControl1.MoveRow(row, newCategoryRow, false);
See Also