Strange IsSubGraphExpanded behaviour

Hi Walter

Consider the following code:

private void BuildDiagram()
{
var diagram = ctlDiagram;

            diagram.StartTransaction("Test");

            var group = new GraphLinksModelNodeData<string>();
            group.IsSubGraph = true;
            group.Key = "TheGroup";
            group.Text = "Grouper";
            group.IsSubGraphExpanded = false;
            group.Location = new Point(100, 100);
            <b>diagram.Model.AddNode(group);</b>

            var n1 = new GraphLinksModelNodeData<string> { Key = "32", Location = new Point(250, 80), Text = "Accounts Payable", SubGraphKey = "TheGroup" };
            var n2 = new GraphLinksModelNodeData<string> { Key = "10", Location = new Point(160, 210), Text = "Administration Expenses", SubGraphKey = "TheGroup" };
            var n3 = new GraphLinksModelNodeData<string> { Key = "22", Location = new Point(330, 210), Text = "Cash", SubGraphKey = "TheGroup" };
            var n4 = new GraphLinksModelNodeData<string> { Key = "16", Location = new Point(183, 329), Text = "Deprecitation", SubGraphKey = "TheGroup" };                    

            diagram.Model.AddNode(n1);
            diagram.Model.AddNode(n2);
            diagram.Model.AddNode(n3);
            diagram.Model.AddNode(n4);                

            diagram.Model.AddLink(n1, null, n2, "T");
            diagram.Model.AddLink(n1, null, n3, "T");
            diagram.Model.AddLink(n2, null, n4, "T");
            

            diagram.CommitTransaction("Test");                                           
        
    }

Note the line in bold. This produces the following: (which is what I expect)

However, if I move the line in bold so that the code now looks as follows:

private void BuildDiagram()
{
var diagram = ctlDiagram;

            diagram.StartTransaction("Test");

            var group = new GraphLinksModelNodeData<string>();
            group.IsSubGraph = true;
            group.Key = "TheGroup";
            group.Text = "Grouper";
            group.IsSubGraphExpanded = false;
            group.Location = new Point(100, 100);
           

            var n1 = new GraphLinksModelNodeData<string> { Key = "32", Location = new Point(250, 80), Text = "Accounts Payable", SubGraphKey = "TheGroup" };
            var n2 = new GraphLinksModelNodeData<string> { Key = "10", Location = new Point(160, 210), Text = "Administration Expenses", SubGraphKey = "TheGroup" };
            var n3 = new GraphLinksModelNodeData<string> { Key = "22", Location = new Point(330, 210), Text = "Cash", SubGraphKey = "TheGroup" };
            var n4 = new GraphLinksModelNodeData<string> { Key = "16", Location = new Point(183, 329), Text = "Deprecitation", SubGraphKey = "TheGroup" };
               

            diagram.Model.AddNode(n1);
            diagram.Model.AddNode(n2);
            diagram.Model.AddNode(n3);
            diagram.Model.AddNode(n4);                

            diagram.Model.AddLink(n1, null, n2, "T");
            diagram.Model.AddLink(n1, null, n3, "T");
            diagram.Model.AddLink(n2, null, n4, "T");


         <b>   diagram.Model.AddNode(group);</b>


            diagram.CommitTransaction("Test");                                           
        
    }

This produces a strange behaviour with the group displaying a self-referencing link:

This seems to happen when setting IsSubGraphExpanded=false on the group. Can you confirm that this is a bug?

Thanks
Justin

That’s interesting. We’ll investigate.