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
185
UltraTree with checkboxes and columns
posted

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);

    aTree.Override.NodeStyle = NodeStyle.CheckBox;

 

    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);

    [... other columns]

 

I even tried setting the checkbox style per node (the commented line) without success.

 

Thanks,

Vlad