Hi,
I'd like to display a hierarchy of the following structure in an unbound (=code-drawn) UltraTree.
So, this could look that way:
I've built two columnsets, colsetDatepart and colsetRequirement, but the UltraTree view style strikes back:
What can I do? Any hint appreciated.
Thanks
Martin
Hello Ivan,
thanks for your answer. That's been my approach as well... But the issue with that approach is that the requirement nodes of "Year" each have a caption. Is there a way to show captions only once per block of consecutive child nodes of the same columnset?
I've edited your screenshot below to be clearer:
Regards
Hello Martin,
Two different column sets could be used for sibling notes, however instead of overriding the column set of the child collection of the parent node, what you would need to do is overriding the columnSet property of the node itself. It could be done with the following code:
childNode.Override.ColumnSet = columnSet1;
This code would affect only the node and not its siblings so each sibling can have a different column set. For example, the Year node can have Half year child node with colsetDatepart, while the YearRequirement nodes can have the colsetRequirement.
Below I am pasting a code snippet that demonstrates what I have explained above, it demonstrates how parent node can have child nodes with different column sets, the code covers only 2 level hierarchy, however the logic for all the other levels is exactly the same to the logic used with 2 level hierarchy.
this.ultraTree1.ViewStyle = ViewStyle.FreeForm; UltraTreeNode parentNode1 = this.ultraTree1.Nodes.Add("Year"); UltraTreeColumnSet columnSet1 = new UltraTreeColumnSet(); columnSet1.Columns.Add("Name"); columnSet1.Columns.Add("A"); columnSet1.Columns.Add("B"); columnSet1.Columns.Add("C"); UltraTreeColumnSet columnSet2 = new UltraTreeColumnSet(); columnSet2.Columns.Add("Name"); columnSet2.Columns.Add("1"); columnSet2.Columns.Add("2"); UltraTreeNode childNode = parentNode1.Nodes.Add(); childNode.Override.ColumnSet = columnSet2; childNode.Cells["Name"].Value = "Half Year"; childNode.Cells["1"].Value = "11"; childNode.Cells["2"].Value = "21"; childNode.Cells["Name"].Column.AutoSizeMode = ColumnAutoSizeMode.AllNodes; childNode = parentNode1.Nodes.Add(); childNode.Override.ColumnSet = columnSet1; childNode.Cells["Name"].Value = "YearRequirement1"; childNode.Cells["A"].Value = "A1"; childNode.Cells["B"].Value = "B1"; childNode.Cells["C"].Value = "C1"; childNode.Cells["Name"].Column.AutoSizeMode = ColumnAutoSizeMode.AllNodes; childNode = parentNode1.Nodes.Add(); childNode.Override.ColumnSet = columnSet1; childNode.Cells["Name"].Value = "YearRequirement2"; childNode.Cells["A"].Value = "A2"; childNode.Cells["B"].Value = "B2"; childNode.Cells["C"].Value = "C2"; childNode.Cells["Name"].Column.AutoSizeMode = ColumnAutoSizeMode.AllNodes; this.ultraTree1.ExpandAll();
I am also attaching a screenshot that demonstrates how would the tree look, when there are sibling nodes with different column sets.
Please let me know if you have any questions.
Regards, Ivan Kitanov