This project is read-only.

Suspending the automatic layout mechanism

Sep 11, 2009 at 8:05 PM

Is there any programatic way of disabling, and reenabling the automatic layout mechanism?  I'm using the Sugiyama layout and adding and removing vertices and edges at runtime.  When the graph has no vertices the layout mechanism fails with an indexing error.  I worked around this by displaying a dummy graph when the logical graph is empty.  When I add vertices to the "empty" graph I then remove the dummy vertices.  However, this does not produce a very pleasing result as the graph is first displayed with the new nodes and edges, plus the dummy graph, and then the layout changes when I remove the dummy entries.  Ideally the layout mechanism wouldn't fail when the graph has no vertices.  But for now is there any way of disabling and then reenabling the automatic layout mechanism programatically so it doesn't attempt to layout the graph when it is the intermediate state where it contains the real graph plus the dummy one?

Nov 12, 2009 at 9:14 PM
Edited Nov 12, 2009 at 9:16 PM

I had a similar problem. I wanted nodes to be added at runtime without layout, while allowing the user to relayout the whole graph now and then on a button click. This kind of thing works:

 private void Button_Click_1(object sender, RoutedEventArgs e)


layout.LayoutAlgorithmType = "KK"


layout.LayoutAlgorithmType =""




Nov 13, 2009 at 4:21 PM

@KevinMitchell: the problem of the empty Graph is solved now. Be sure that you are using the latest version on the control.

Currently there is no possibility to disable the automatic relayout of the graph. 

Please, open a topic  in the Issue Tracker



Nov 15, 2009 at 6:51 PM

I just set the layout algorithm to empty and the automatic relayout stops (see above code).