Diagram not loading properly

I am saving diagram by drawing different shapes and links to database in xml format.
But when i load the diagram the links get scattered and diagram looks weird.
This happens diagram is having horizontal scrollbar.I am using MakeXElement and LoadFromXElement.
How to fix this?

It’s hard to know how to help you given the information that you have provided.

How is what you are doing different from what the samples do that load and save their models to XML? Does the saved XML actually have all of the information your Node and Link DataTemplates need in order to render themselves they way you want via data-binding?

I am providing all the information needed in order to render the shapes and links.It renders fine after loading if i drop shapes and links in such a way that there is no horizontal scrollbar on the diagram and i save that diagram.But when i drop a shape outside visible area of diagram and save that diagram and save it then after loading, it doesn’t load correctly.Now when i check the xml from database and xml generated by
_savedDiagram = Save<ShapeViewModel, LinkViewModel>(“Diagram”, “Node”, “Link”);
these two are different.
The points in links are different from that of database xml links.

one more thing.even if there is vertical scrollbar then also same problem occurs.

So if I understand you correctly, the XML that you load is correct – it has all of the correct values. However if the nodes are sufficiently far apart such that they do not all fit in the viewport, the diagram correctly has a scrollbar and the nodes are in the correct positions but some links have the wrong routes. And your XML includes the routes (i.e. the list of points) for all of the links.

Could you help me reproduce this problem? Could you send us a demo project? Could you at least tell us more about what you are doing and what software you are using?

yes you are correct…

Here is the xml for diagram before save.

and this one is after load…which we saved previously…

as you can see link points are different in above two xml…

Yes, I see that. But I believed you before, so showing the XML doesn’t really help me reproduce the problem.

How are you loading the link points? Do you do what the samples do? Basically you have to wait until all of the nodes have been realized and the layout has completed animation before you can set the Link.Route.Points.

And if you could answer my earlier questions, that might help too.

Thanks walter. Problem is resolved.It was happening because we were making asynchronus calls by webservice to db and the diagram layoutcompleted was getting called before.So the routes were getting assigned before all db calls were completed.So i handled the layout completed event after all db calls get completed.

Thanks a lot…Smile