FlexGrid for WinForms
Creating Custom Trees
Show AllShow All
Hide AllHide All

To create outline trees without using the Subtotal method, you need to follow these steps:

  1. Add rows to the grid.
  2. Turn some rows into outline nodes by setting their IsNode property to True.
  3. Get the Node object for each node row and set its Level property to define the node' s position in the tree hierarchy. Higher values mean the node is deeper (more indented) into the outline tree.

For example, the code below creates a directory tree:

To write code in Visual Basic

To write code in C#

The code above initializes the grid layout and calls the AddDirectory routine that does the job of populating the grid and setting up the tree structure:

To write code in Visual Basic

To write code in C#

AddDirectory is a recursive routine that traverses the current directory and all its subdirectories. In this example, the tree size is limited to four directory levels in order to save time. In a real application, the routine should be changed to populate tree branches only when they are expanded (see the FlexGrid for WinForms Tutorials).

This code creates a grid that looks like this:


See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback