I've got a custom list that I'm binding to the tree, which works fine. I don't want checkboxes throughout every level of the tree, I just want checkboxes on the nodes at the LAST level (last descendant).
At the moment, I'm able to handle the InitializeDataNode event, and see the nodes being initialized. When a node's ListObject happens to be of a specific type (my custom type), I set the Override property of that node, like this:
private void ultraTree1_InitializeDataNode(object sender, Infragistics.Win.UltraWinTree.InitializeDataNodeEventArgs e) { if (e.Node.ListObject is MyObject) { e.Node.Override = _over; } }
The _over object is just a class-level Override, which looks like this:
_over.NodeStyle = NodeStyle.CheckBox;
PROBLEM IS.... even though I can see the Override property being set, the checkbox never shows up in my tree. Any ideas?
Thanks guys!
The grid cannot have "standard" nodes, so if that's what you want, I would stick with the tree.
You can do all of this with the tree, though.
If you are binding the tree, then the Company and Employee nodes will show columns. If you don't want that, it's very easy to turn off. All you have to do is use the ShowColumns property on the Override. In this case, you would probably want to use one of the NodeLevelOverrides to turn it off on a particular level (or in this case 2 levels) of the tree.
The nodes will still have a ColumnSet assigned and you need to set the NodeTextColumn on that ColumnSet to indicate which field the node should use for it's display text when not showing all of the columns. The ColumnSetGenerated event is an ideal place to do this.
Hey, thanks Mike. Very well explained. You brought up a related point, which I'll address using the following dummy data structure:
[Root - not displayed] Company Employee Car Company Employee Car Car Car
Turns out, it'd be nice if I could display the Company and Employee levels as "standard" nodes (and maybe some custom icons?), and allow the user the see only the Car information in a grid format, and allow individual Car rows to be selected via a checkbox. Is it possible?
The more I think about it, do you think it would make more sense to do this whole thing with an UltraGrid control?
Thanks again, Don
Hi,
If you are binding the tree to a data source, then the tree is probably displaying in a grid style with columns. The CheckBox setting you are using here only applies to standard nodes, it does not apply to nodes that are in a grid style.
If you want a checkbox in a grid-style node, you will need to put the checkbox into a column. So what you probably need to do here is an an unbound column to the ColumnSet that is being used by your lowest-level nodes.
So, assuming you are not creating the column sets yourself and that you are just letting the tree generate them automatically, then what you should do is handle the ColumnSetGenerated event and check the Key of the ColumnSet to find the right one for the band of data at the lowest level. The you can add a column to that ColumnSet and set it's DataType to boolean to make it a checkbox.