IsSubGraphExpanded bug?

Hi Walter

I think I may have encountered another bug regarding groups and the IsSubGraphExpanded property. Consider the following two methods

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");



            diagram.Model.AddNode(group);

            diagram.CommitTransaction("Test");                                           
        
    }:

private void ExpandGroup()
{
var diagram = ctlDiagram;
var group = (GraphLinksModelNodeData) diagram.Model.FindNodeByKey(“TheGroup”);

        diagram.StartTransaction("ExpandGroup");

        group.IsSubGraphExpanded = !group.IsSubGraphExpanded;

        diagram.CommitTransaction("ExpandGroup");
    }

Initially I call BuildDiagram() which creates the group and it’s children. It also sets IsSubGraphExpanded = false. This creates the following, which is what I expect:

I then call the ExpandGroup() method, expecting the group node to expand and reveal it’s children. However, the group remains collapsed as in the picture above.

Thanks
Justin

Adapting this code in an old version of your app, I found that Group.IsSubGraphExpanded was not being changed at all. I believe the reason is that the binding for it ought to be Mode=TwoWay.

Hi Walter

That solved the problem but it seemed to have introduced an unexpected behaviour. The expanded group now renders as follows:

When it should be rendering as follows:

Thanks
Justin

OK, we’ll investigate this too.