ComponentOne FlexGrid for WinForms
Using the Node class
Using the C1FlexGrid Control > Outlining and Summarizing Data > Using the Node class

The Node class provides a number of methods and properties that can be used to create and manage outline trees. Many of these methods and properties are based on the standard TreeView object model, so they should be familiar to most developers.

To obtain a Node object, you can either:

Use the return value of the Rows.InsertNode method:

var node = _flex.Rows.InsertNode(index, level);

Or you can retrieve the node for an existing row using the row's Node property:

var node = _flex.Rows[index].IsNode
   ? _flex.Rows[index].Node
   : null;

Either way, once you have a Node object you can manipulate it using the following properties and methods:

You can also explore the outline structure using the following methods:

The discussion above focused on bound scenarios, where the grid is attached to a data source that provides the data. You can also create trees and outlines in unbound scenarios. Things are actually somewhat simpler in this case, since you can turn any row into a node row by setting its IsNode property to true.

If the grid is unbound, it owns all the data that is displayed, and you do things that are not possible when a data source owns the data. For example, you can move nodes around the tree using the Move method as shown by the TreeNode sample provided with the C1FlexGrid.

Using nodes in an unbound grid is very similar to using nodes in a regular TreeView control.

See Also