You'll need to modify it if you want to run the Tree Grid View without visual styles. The basic part of creating a Data Grid View that can expand and collapse is to dynamically add and remove rows. To make this really usable and extendable, I decided to add a lot code and make this easier to use.Some people have been able to modify the code to run without Visual Styles. Here are some details: I wanted to ensure that the design of the Tree Grid View supported normal Tree View type properties and features, so creating necessary classes to create the “tree view” experience wa necessary (see object model for more details).

datagridviewcheckboxcolumn not updating-31

The main thing that this custom cell class does is to customize the cell drawing to make it look like a tree node.

That means that it draws the node’s image and the /- icons and the tree lines.

The custom cell also is where a node detects when you click the mouse to expand or collapse a node.

NOTE: A lot more work can be done to correctly detect that the mouse is directly over the /- image. Tree Grid View – This class derives from the Data Grid View control. Nodes are sited/unsited in the grid as actual rows.

I have code to handle the F2 key to enter edit mode.

There are other ways to solve this, but I went with the F2 approach.

When the node is displayed or in the grid, it is sited.

When the node is sited I set all the necessary properties.

With the normal Tree View usres add temp child nodes to get the sign and support expanding, then remove the temp node later.

With the Virtual Nodes property, the Tree Grid View always displays a sign next to a node, even if the node doesn’t have any children.

Somce Data Grid View Properties are hidden since they do not apply.