BeginUpdate, EndUpdate?

program is working good and the first customers are using it.
Now I have the problem that loading of a saved diagram needs nearly 30seconds and 11seconds are used with several calls to OnChanged->OnModelChanged->DoRebuildNodeElements->AddNodeForData and so on.

Is there a way to call something like BeginUpdate then load and then EndUpdate to do the diagram update only one time after load?

Or is there another way to do this?

Make sure the model is wholly initialized and loaded into memory before assigning Diagram.Model.

I still have problems here.

if (File.Exists(filename))
    var oldDiagramModel = Diagram.Model;
    Diagram.Model = null;
    Diagram.Model = oldDiagramModel;

I’ve tried the following, but with over 1900 Node it still take30sec. to load. The xml-file is 1.6MB in size, but it must be possible to do this faster.

Any Idea?

LoadXmlConfig does nothing more than this:

var xdoc = new XmlDocument();
Load<Element, ElementLink>(root, "Element", "ElementLink"); // <- Model.Load

Have you read the “Performance Considerations” section of the GoXamIntro.pdf document? It’s the last section.

1900 are not really “many thousands” :-(

Not all this nodes are visible on startup. Do you have a solution in mind where I can create only the visible nodes and create the other nodes when needed?

If most of the time is going into building all of the Node and Link FrameworkElements, there’s nothing we can do, because it’s all part of WPF instantiating templates and evaluating bindings.

The only real work-around is to implement virtualization. That requires programming work, and it requires a lot of work if you depend on some kind of automatic layout, because the layout has to work on the model data rather than on real Nodes and Links.