Is changing the Style property of a Diagram, at run-time, supported?
When I try it I get inconsistent results.
Here is what a Diagram initially looks like with “Style A” set:
I then change the Style property of the Diagram to “Style B”:
I then change the Style property of the Diagram back to “Style A”. Sometimes this works and displays the same as in the first screenshot. However, sometimes artifacts of the previous Style remain:
I suspect that is because of the simple “virtualizing” that GoXam does in order to improve performance. You can disable that by adding this when you initialize the Diagram:
But even after calling the above methods the links are still not plotted correctly. They are plotted against the ports (elements where PortId has been set) of the previous style.
The issue only occurs if the Node DataTemplates specify PortId values. For eg:
You really shouldn’t have to call Rebuild…, although it shouldn’t do any harm (besides waste time and space) if you do. It ought to be enough to call Link.Route.InvalidateRoute() on each Link.Route
I would have thought that calling LayoutDiagram would be sufficient too, but I think that depends on how the layouts are defined.
But if that doesn’t work, I’m not sure what’s going on in your app.