Cant hide subgraph node

The code below is based on your piping demo. I am trying to assign some objects (anodes) by defining a subgraph that could contain one or multiple anodes.

When the model is loaded, every thing looks fine, but when I start to drag the end node both the subgraph node and the ordinary node(s) are displayed (see attached figure). Why is the supgraph node visible?

=====

private void AddPipeToModel(IPipe 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);
pipeData.Label = “[” + pipe.Index + “]”;
if (pipe.ProjectVersion.ShowPipeNames)
{
pipeData.LabelVisibility = System.Windows.Visibility.Visible;
}
else
{
pipeData.LabelVisibility = System.Windows.Visibility.Collapsed;
}

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

            // Add anodes
            foreach (IAnode anode in pipe.Anodes)
            {
                AnodeData anodeNode = new AnodeData();
                anodeNode.Key = "A" + anode.Index;
                anodeNode.Index = int.Parse(anode.Index);
                anodeNode.SubGraphKey = anodeSubGraphNode.Key;
                anodeNode.Location = new Point(0, 0);
                nodes.Add(anodeNode);
            }

            pipeData.LabelNode = anodeSubGraphNode.Key;

            nodes.Add(anodeSubGraphNode);
        }

        pipes.Add(pipeData);
    }

I’m not sure I understand your situation. It depends a lot on the templates that you are using. If setting “anodeSubGraphNode.Location” to a non-real Point (by using NaN) causes the corresponding Group DataTemplate to assign a NaN,NaN Point to the Group.Location, then I could see how the Group would not be visible initially.

Then when moving a Node connected with that Link ("[10]" in your screenshot, I assume) would cause the Link to be re-arranged, including arranging the link label Node (actually a Group) to be on the Link. The DataTemplate used for the AnodeData objects might affect the behavior, though, so I can’t say for sure.

I found the solution, I had not defined any group template

I added a group template:

<go:DataTemplateDictionary x:Key=“GroupTemplateDictionary”>

</go:DataTemplateDictionary>

Then assigning the diagrams’s GroupTemplateDictionary to this value
GroupTemplateDictionary="{StaticResource GroupTemplateDictionary}"