Hi,
I'm trying to create a UltraTree with several columns and checkboxes for the nodes. For some reason I can't get the checkboxes to appear. The only thing that seems necessary to get checkboxes is to set
aTree.Override.NodeStyle = NodeStyle.CheckBox;
At least this is the only thing I saw set in the UltraTree Cell Editing sample that shows a tree of Events with checkboxes in front.
Is there something I need to be aware of in order to get checkboxes? Maybe defining custom columns affects this behavior somehow?
I initialize the tree like this:
aTree.Override.CellClickAction = CellClickAction.EditCellSelectText;
aTree.ViewStyle = ViewStyle.OutlookExpress;
aTree.ScrollBounds = ScrollBounds.ScrollToFill;
aTree.ExpandAll(ExpandAllType.Always);
UltraTreeColumnSet columnSet = aTree.ColumnSettings.RootColumnSet;
UltraTreeNodeColumn nameColumn = columnSet.Columns.Add("Name");
nameColumn.DataType = typeof(string);
nameColumn.LayoutInfo.PreferredLabelSize = new Size(100, 0);
[... other columns]
and then add nodes like this:
UltraTreeNode node = aTree.Nodes.Add();
node.CheckedState = CheckState.Checked;
//node.Override.NodeStyle = NodeStyle.CheckBox;
node.SetCellValue(aTree.ColumnSettings.RootColumnSet.Columns["Name"], name);
I even tried setting the checkbox style per node (the commented line) without success.
Thanks,
Vlad
Hi Vlad,
NodeStyle only applies to nodes in the Standard ViewStyle. You cannot add a checkbox to nodes in a grid-Style tree using NodeStyle, you have to add a column. What I would do is handle the ColumnSetGenerated event and add an unbound column to the ColumnSet and set it's DataType to Boolean. That will give you an unbound CheckBox column in the tree.
Thanks. This is what I was going to do in case there is no support built in. But that's too bad because the standard checkboxes sit nicely in front of the node name while a separate column lines them up vertically in the column.