Pragramatically expand GoSubGraph


I can programatically expand GoSubGraphs using the Expand() method, but the child nodes are squashed together. If I manually expand a GoSubGraph using the + handle, the nodes are in their correct positions.
What is the correct way to programatically expand a GoSubGraph so that behaviour is exactly the same as a manual expansion ?
As an alternative to the Expand() method, I also tried raising an event:
Northwoods.Go.GoInputEventArgs evtArgs = new GoInputEventArgs();
this.RaiseObjectSingleClicked(sgNode.Handle, evtArgs);
but this had no effect.


I just tried this, and calling GoSubGraph.Expand() works the way I think you want. I had a form button click event handler do:
GoSubGraph sg = myView.Selection.Primary as GoSubGraph;
if (sg != null) {
where GoSubGraph.Toggle is defined as:
public void Toggle() {
if (this.IsExpanded)
There must be something else going on to account for the behavior that you are seeing.


I had nested sub graphs, and my code was expanding child nodes while their parent sub graphs were still collapsed.
That sequence cannot happen when manually expanding nodes, of course.
I modified my code to ensure parent subgraphs are expanded before any of their child subgraphs, and it works fine now.