Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
50
Is there a way to not show a checkbox if a node has children?
posted

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

Parents
  • 469350
    Verified Answer
    Offline posted

    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.  

Reply Children
No Data