Usage of UnloadingClearsPartManager

If I set Diagram.UnloadingClearsPartsManager to False, do I need to do anything special to clear out the diagram control and release the memory? My Diagram object sits inside of a Telerik docking pane (techincally, a Telerik.Windows.Controls.RadPane). This pane is similar to a standard TabItem inside of a TabControl, but does not share the same object hierarchy so I don’t get the benefit of any special TabControl handling code.

It’s funny that this property is such a popular topic.

No, all you need to do is set Diagram.UnloadingClearsPartManager back to the default value, true.

Presumably the only reason you have set this property to false is to preserve some transient (non-model) state or to improve performance when switching “tabs”.

[QUOTE=walter]No, all you need to do is set Diagram.UnloadingClearsPartManager back to the default value, true.

Presumably the only reason you have set this property to false is to preserve some transient (non-model) state or to improve performance when switching “tabs”.

[/quote]

When would I set UnloadingClearsPartManager back to true? Just before I dispose of the object? Am I correct in assuming that the PartManager maintains a strong reference to instances of the controls or am I reading too much into your answer?

I’m setting the property to false to work around an issue. Further investigation has shown it to be unrelated to this property, so I’m off to make another thread for that issue.

The issue is not that some FrameworkElements such as a DiagramTool or PartManager may have a back-pointer to the Diagram – that’s expected and is not a problem.

The issue is that the data may have references to the Parts (and thus to the Diagram) due to data-binding.