Skip to main content

CategoryRow(String) Constructor

Creates a new CategoryRow object with the caption specified.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v24.1.dll

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

Declaration

public CategoryRow(
    string fCaption
)

Parameters

Name Type Description
fCaption String

A string value specifying the category row’s caption. Sets the RowProperties.Caption property value.

Remarks

Use this constructor to programmatically create a new category row with the caption specified. The constructor initializes the RowProperties.Caption property with the parameter value, other properties are set to their default values. If you need a new category row to be created with default settings, you should use the constructor with no parameters.

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 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 with the specified caption. 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 with the specified caption
CategoryRow newCategoryRow = new CategoryRow("Performance Attributes");

// assigning the name to the created category row
newCategoryRow.Name = "categoryRow_Performance";

// 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