Hi
I have a treeview bound to one SQL data table. I want run time uses to be able to use checkboxes on nodes at the end of each tree branch. In other words I only want runtime users to only be able to select checkboxes on nodes without children.
I am currently using the Override1.NodeStyle = Infragistics.Win.UltraWinTree.NodeStyle.CheckBox property to show the checkboxes on the treeview.
The best way to do this would be to only show a checkbox on nodes without children. Is this possible? and can someone tell me how the code should look.
Thanks
Matthew
Hi Matthew,
The Override object exists on many different levels. There's an Override on the tree itself. There's the NodeLevelOverrides whic correspond to the levels in the hiearchy. There is an Overide on the nodes collection. And there is an Override on each individual node. So you can turn checkboxes on and off on any node you like.
So the only question is, how do you determine which override to use. Do you know the data strcuture? If so, then you can property use the NodeLevelOverrides to have CheckBoxes on every node on a particular level (the last level in the data hierarchy).
If you don't know or the data is irregular, then you can use the InitializeDataNode event and set the Style on the node there after checking the node.Nodes.Count. The down side of this approach is that the tree loads data on-demand by default. By doing this, you will force the tree to load all of the data at once, since it will have to load the data in order to access the child node count.
Thanks Mike
Knowing that I could uses the override for an individual nodes it was easy.
Here is the code I used as part of a Sub that Transverses all nodes from the top down.
If node.HasNodes Then node.Override.NodeStyle = UltraWinTree.NodeStyle.StandardElse node.Override.NodeStyle = UltraWinTree.NodeStyle.CheckBox
End If
Kind Regards