Skip to main content

CategoryRow() Constructor

Creates a new CategoryRow object with default settings.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v23.2.dll

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

Declaration

public CategoryRow()

Remarks

Use this constructor to create a new row of the CategoryRow type at runtime. The constructor initializes the created category row with the default settings. If you need a new caption row to be created with the specified caption, you should use the constructor with the caption parameter.

You can use the methods and properties of the newly created row object to adjust it as your application needs dictate: you can specify its name, caption, caption image, style, assign a collection of child rows, etc. The created category row should be added to a row collection in order to be displayed. Row collections can be accessed via the VGridControlBase.Rows or the BaseRow.ChildRows property. These properties are represented by instances of the VGridRows object which provides methods to add and delete individual rows.

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