I am trying to create a treeview that looks something like the following:
Parent
|__Child1
|__ __ __ O Grandchild1
|__ __ __ O Grandchild2
|__Child2
|__ __ __ O Grandchild3
|__ __ __ O Grandchild4
I am using vb.net in Visual Studio 2008. Any insights as to how I can accomplish this will be very much appreciated!
You cannot have radio buttons in a TreeView, only checkboxes.
A solution would be to make the checkboxes behave like radio buttons:
The
e.Node.Level = 2check makes sure only grandchild nodes behave like radio buttons.Set the TreeView’s
CheckBoxesproperty toTrueto enable checkboxes.This is an example of how to change text style of selected nodes and its parents:
It recursively changes the text style of the selected node and its parents and sets it back to the TreeView’s default style when the selection changes.