Link Label issue

Hi,

as a newbie, I have been using your piping demo to build a model with similar characteristics.

I have made my model work, but have a problem with the link labels. The following code shows how I am adding pipes and its corresponding anodes to my model. Below a figure that shows the result. The text PartManager.PartBinding of Group to 56 appears, how can I hide this?

private void AddPipeToModel(Pipe pipe, ItemData headNode, ItemData tailNode, ObservableCollection nodes, ObservableCollection pipes)
{

PipeData pipeData = new PipeData();
pipeData.Index = int.Parse(pipe.Index);
pipeData.FromNode = headNode;
pipeData.ToNode = tailNode;
pipeData.Colour = Force.CommonLibrary.ForceColor.GetHexColor(System.Drawing.Color.Black);

        if (pipe.Anodes.Count > 0)
        {
            AnodeData anodeSubGraphNode = new AnodeData();
            anodeSubGraphNode.Key = pipe.Index;
            anodeSubGraphNode.IsSubGraph = true;
            anodeSubGraphNode.Location = new Point(double.NaN, double.NaN);
            pipeData.LabelNode = anodeSubGraphNode.Key;

            // Add anodes
            foreach (Anode anode in pipe.Anodes)
            {
                AnodeData anodeNode = new AnodeData();
                anodeNode.Key = "A" + anode.Index;
                anodeNode.Index = int.Parse(anode.Index);
                anodeNode.SubGraphKey = anodeSubGraphNode.Key;

                nodes.Add(anodeNode);
            }

            nodes.Add(anodeSubGraphNode);
        }

        pipes.Add(pipeData);
    }</i>

Is your model’s NodeKey parameterized type an integer? I believe that it is, based on your assigning .Key = pipe.Index.

So if a link does not have any label nodes, do you make sure that the value of the link data’s “LabelNode” property (or whatever you have assigned to GraphLinksModel.LinkLabelNodePath) is not accidentally the key for some random node data? The problem is that the default value for integers is zero, so the default value for GraphLinksModelLinkData.LabelNode will be zero. But zero might be the key for some legitimate node data in your model.

Another potential problem is that GraphLinksModelLinkData only has a single LabelNode property. Since the Piping sample assumes there can be any number of Nodes that are owned by a Link (arranged along the Link’s route), the Piping sample has to use a Group as the node referred to by the LabelNode property. That Group of course can have any number of Nodes as members. But perhaps your model doesn’t happen to have a group data object for each link data.

Based on your reply, I found the error.

First - my NodeKey was actually a string (the property “Index” is a string).

The answer was in the diagram definition, the NodeTemplateDictionary was defined, but there was not defined any GroupTemplateDictionary. Doing this, solved my problemsSmile.