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

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    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.

Children