Sometimes it results in "sticking" nodes as shown at the 1st figure.But if the user selects another list item (which means creation of a new Model based on another data) and then select the initial one once again (which means creation of a new Model based on the same data as the 1st time) the diagram looks well as shown at the 2nd figure.
Instead of starting by setting Diagram.Model = null, why not leave it with an empty Model? That is the default value, and you can disable or make the diagram read-only if you like.
I still don’t understand the circumstances under which you get the bad layout of a Group. Does it only happen with the first model that you load (that has nodes in it) during the running of the app? Then whether you reload the same model or you load a new model it’s always good?
If so, I’m wondering if maybe it’s due to the layout happening when some Images had not yet been loaded. Try explicitly setting the Width and Height of your Image elements.
It is SL, sorry for not specifying that.
This issue occurs not only with the 1st model having nodes. Sometimes I load one model and everything goes well, but then I load another one and layout gets bad.
However I’ve tried setting images size explicitly and it changed nothing - the layout still gets spoiled.
So now the question is: what about your templates and code is it that causes layout animation to sometimes do the wrong thing? I don’t have a good answer for that. But whether you want to spend time helping me pursue this issue is up to you. If turning off layout animation works for you, you don’t have to do anything more.