Merging links between child of subgraphs-collapsed


In the sample Demo1, I see that when multiple children of a subgraph
(outer-inner) is connected to children of another instance of subgraph
and when we collapse one of them, Links are merged and converge
on the same point of collapsed subgraph.
Is this feature comes by default or do we need to do some customization in our code and how this is done in GoDiagram classes. I went through the code but could not get any hint on this. I need this feature in my application also which contain custom GoSubgraphs, custom GoLinks, Custom Ports and custom GoNodes. I found that somehow this functionality is broken because of customization/overriding done in my code and links remain at the same position even after collapse. I wanted to find/isolate the root cause of this behaviour in my application and correct it so that it behaves as it is in Demo1 sample application.

The SubGraph at the top of Demo1 is a GoSubGraph… the base class with no customizations.

Can you tell us more about how your app is broken?

In my application

In GoSubgraph custom class, I have overriden following functions


Collapse ( here only setting bottom right margin).
But the link created between subgraphs is being added to a
GoSubgraphBase derived object which is then added to view's document.
Please let me know if you need more information.

could you post before & after screenshots?


I have e-mailed Expanded and Collapsed JPEG images
to Please let me know if I need to
send this to other address.

It appears the problem is that you have one or more complex nodes that are children of your GoSubGraph node.

GoSubGraph.Collapse will move the child nodes and make them not-Visible. It will also collapse nested subgraph nodes. But it won’t do anything else for other kinds of child nodes, so those ports will still be positioned separately from each other, if they had been separate when the child node had been visible.

So you should override the GoSubGraph.CollapseChild and ExpandChild methods to deal with your child nodes specially, in addition to the usual stuff by calling the base method.

Assuming your child nodes are instances of GoMultiTextNode, I think when collapsing, you’ll want to set GoMultiTextNode.ListGroup.TopIndex = 0 and change the height of the GoMultiTextNode.ListGroup to 0. That will cause GoListGroup to hide and superimpose all of its children, thereby getting all of the ports to be overlapping too on each side.

When expanding, set GoMultiTextNode.ListGroup.TopIndex = -1.


Thanks for the reply. I use GoListGroup. I tried overriding CollapseChild/ExpandChild, Now links are converging but the point of covergence is not at the left border collapsed subgraph. It is somewhere inside subgraph bounds. Also when we expand, the GoListGroup is not restored to original state. I saw change in bounds of members of the list group and enclosing GoRectangle which is child of Node. I tried to save the height and restore it on expand. But it is also not working. I have sent the images of Start, Collapse and expand pictures to