HI, I am wondering if there is an example by using UltraTree and UltraGridCan we add a UltraGrid as a child node to a Tree Node.
I am basically looking into some functionality where the headers act like a Tree Node that can be collapsed and the body is a ultraGrid like structure. I cannot use a Grid solution only since the data for the header and the body has no relation.
- SomeText1 CheckBox Text Box ComboEditor CheckBox Text Box ComboEditor CheckBox Text Box ComboEditor CheckBox Text Box ComboEditor
- SomeText2
CheckBox CheckBox ComboEditor TextBox CheckBox CheckBox ComboEditor TextBox CheckBox CheckBox ComboEditor TextBox CheckBox CheckBox ComboEditor TextBox CheckBox CheckBox ComboEditor TextBox
ThanksAJ
Hi AJ,
I'm not sure I understand your question. What exactly are you trying to go here that you can't do with the WinTree alone? There's no way to embed a WinGrid within a tree. But the tree itself supports columns, so you could do what you have here with just a tree, you don't need a WinGrid.
Hi Mike, Thanks for getting back to me.
Like my previous post with the example, I am trying to accomplish a tree like structure with collapsing header nodes. The Child nodes under a header section differ. They are not consistent. The child to the header node mimics like a grid. Each column (Cell) is a Control (e.g, Checkbox, combo, text box, etccc). The number of rows is not finite. My initial thought was can a (UserControl) be added as a child node? I guess this is not possible.
Do let me know if I am not clear in my explanationThanksAditya
Hi Aditya,
You can't embed another control or grid inside the three. But you do not have to. The tree already supports a grid-like display just like you have here.
What you would do is add your root level nodes to the three. Then for the child nodes, you would apply a ColumnSet to the nodes collection's Override with a set of columns that you would. For the node under the second parent node, you would apply a different ColumnSet with a different set of columns.
Here's a little sample code I whipped up to demonstrate how to set up a tree like this:
this.ultraTree1.ViewStyle = ViewStyle.FreeForm; UltraTreeNode parentNode1 = this.ultraTree1.Nodes.Add("Parent 1"); UltraTreeNode parentNode2 = this.ultraTree1.Nodes.Add("Parent 2"); UltraTreeColumnSet columnSet1 = new UltraTreeColumnSet(); columnSet1.Columns.Add("A"); columnSet1.Columns.Add("B"); columnSet1.Columns.Add("C"); parentNode1.Nodes.Override.ColumnSet = columnSet1; UltraTreeColumnSet columnSet2 = new UltraTreeColumnSet(); columnSet2.Columns.Add("1"); columnSet2.Columns.Add("2"); parentNode2.Nodes.Override.ColumnSet = columnSet2; UltraTreeNode childNode = parentNode1.Nodes.Add(); childNode.Cells["A"].Value = "A1"; childNode.Cells["B"].Value = "B1"; childNode.Cells["C"].Value = "C1"; childNode = parentNode1.Nodes.Add(); childNode.Cells["A"].Value = "A2"; childNode.Cells["B"].Value = "B2"; childNode.Cells["C"].Value = "C2"; childNode = parentNode1.Nodes.Add(); childNode.Cells["A"].Value = "A3"; childNode.Cells["B"].Value = "B3"; childNode.Cells["C"].Value = "C3"; childNode = parentNode2.Nodes.Add(); childNode.Cells["1"].Value = "11"; childNode.Cells["2"].Value = "21"; childNode = parentNode2.Nodes.Add(); childNode.Cells["1"].Value = "12"; childNode.Cells["2"].Value = "22";
Thanks for the sample code Mike.
I did get the sequence of steps that need to be done to form the tree.I was missing a step in between. The way we were adding the columnSets to the parent node was different.
Thank You once again. Aditya