Reconstruct layout on diagram

I’m used Telerik Docking for silverlight.

The Stancil and DocumentHost is usercontrol used GoXam.

The DocumentHost comprises multi document.

1st, It is open diagram(xml) at OVERVIEW document.

=> The opend diagram is extremely normality. shape, location, color, etc…

2nd, Change active document to NCC.

3td, Change active document to OVERVIEW

=> Then linked line’s location was rearranged.

[Issue> The layout no recontrunt and I want to keep original layout.

1,2,3 link was changed location.

Are you using an actual System.Windows.Controls.TabControl in the Document Host area?
Judging from the behavior, I’m guessing not.
If that’s the case you need to set Diagram.UnloadingClearsPartManager to false.

What’s happening is that what you are using is detaching the old tab item from the visual tree when it is switching to a different tab, causing the new tab item to be re-inserted into the visual tree.
That causes the controls in the old tab item to be unloaded, and the new ones to be loaded.

When a Diagram is unloaded, we normally clean up everything in order to avoid memory leaks.
If the Diagram is loaded again, we reconstruct all of the Nodes and Links again from the Model.
This might cause some loss of state.
In your case it appears that Link routes are not being saved in the model, so when the Link is created again, it uses the default routing (which seems to “AvoidNodes”).

However if the Diagram is inside a TabControl, we don’t do that clean-up – all of the Parts remain in memory, so that if the Diagram is reloaded because it is part of the new current tab, it is exactly the same as before.

But it seems that the Diagram doesn’t know that it’s in a TabControl, so you’re going to have to tell it by setting Diagram.UnloadingClearsPartManager property to false.

thanks walter.

I solved it by setting property but we need to endure memory leaks.

Diagram.UnloadingClearsPartManager = false.