Hi,
for my application i need to build a tree with dynamic created Nodes, each biulded with the statements as follows. With the builded tree i have even mor the one problems.
// Add the workpieceTree UltraTreeNode nodeWP = this.ultraTreeRequirements.Nodes.Add("Laborhilfsmittel"); UltraTreeNode nodeComp = ultraTreeRequirements.Nodes.Add("Komponenten"); ObjectQuery<ECU_WorkpiecesGroups> eCU_WorkpiecesGroupesQuery = editChangeHandler.ObjectContext.ECU_WorkpiecesGroups.Where ("it.ParentWorkpiecesGroup.ID = 467"); nodeWP.Nodes.SetDataBinding(eCU_WorkpiecesGroupesQuery.Execute (MergeOption.AppendOnly).ToList(), ""); // Now Add the tree part for DUT-Components ObjectQuery<V_tscm_Components> componentQuery = editChangeHandler.ObjectContext.V_tscm_Components; List<V_tscm_Components> coList = componentQuery.Execute(MergeOption.AppendOnly).ToList(); nodeComp.Nodes.SetDataBinding(coList, "");
And now the problems:
1. Problem: Since I use the EntityFramework in don't have a DataMember to use. The string for this must always be empty. Because of this the UltraTree trys build the same Column Set for each Node. It's possible, to tell the UltraTree that he has to build different Nodes, perhaps as a function of RootNode?
My Workaround at this time is to give each of the Objects the same signature (public variables and Lists). But the problem will be more significant, because each of the siblingNodes in the second and third level has Sublists of other Types.
2. Problem: I try to give the Nodes ,each in dependency of his Nodetype and Type of the ListObject a Icon. The Part to set the Icons for BandNodes works fine, but int the part to set the ObjetNode Icons the GUI shows no icons. If I debug through the code the LeftImage will be set and the node object ist right initialized.
private void setNodeAppearance(UltraTreeNode node) { ...
if ((node.IsBandNode) && (node.BandName == "ChildWorkpiecesGroupList")) { node.Text = Resources.NodeNameChildWorkpiecesGroupList; if (node.LeftImages.Count == 0) { node.LeftImages.Add(Resources.ManyDeliveryWorkpiecesIcon); } }... if (!node.IsBandNode) { // Knotentyp abfragen string nodeType = node.ListObject.ToString(); if (node.LeftImages.Count == 0) { switch (nodeType) { case "ECUManDeliveryScheduleBase.ECU_Requirements": node.LeftImages.Add(Resources.Requirement); break; case "ECUManDeliveryScheduleBase.V_tscm_CVR_Samples": node.LeftImages.Add(Resources.DeliveryWorkpieceIcon); break; } } } }
Thanks for your help, greatings: Rudy
Node images are not displayed when the ViewStyle is set to anything other than 'Standard'. You can add a column of type System.Drawing.Image and use an EmbeddableImageRenderer in that column to display the images in a column.