my work bases on the dynamicPorts example. I use a tabcontrol to handle more than one diagram. When i change the route of a link manually by drag and drop, this new route did not stay after i switched to another tab. When i switch back to the diagram with the changed route OnLinkAdded is called and “link” has the wrong Points, in link.Data are the correct ones, so i copied it, but it didnt work. How can i avoid this behaviour?
Set Diagram.UnloadingClearsPartManager = false.
Yeah, this works perfect, thank you very much :)
i think i was a little bit too fast and forgot to remove the code, that did this work for me(staying the link routes at tabchange). The Diagram.UnloadingClearsPartManager = false did not work for me. I did this by saving and loading the diagram at tabchange, but this solution confuses the undomanager. Maybe there is another manual workaround?
The state of each Diagram ought to remain precisely the same after changing tabs and then back.
What actions are you performing when the current tab changes?
I only set a property SelectedIndex and switch to the other diagram. Neither a costructor is called, nor the mothod UpdateRoutes from the example dynamicPorts…Maybe this is wrong?
What do you mean by “set a property SelectedIndex and switch to the other diagram”?
Perhaps I do not understand your situation. I thought you were saying that if you have a Diagram in a tab, then switch to a different tab and then back again, some state in the Diagram has changed. If you are using a mechanism that unloads Controls and that isn’t the standard TabControl, and if you want to maintain the state, you want to set Diagram.UnloadingClearsPartManager = false.
If you are doing anything when the user switches tabs other than initializing when the tab is selected for the first time, I would reconsider those actions.
Problem is solved. UpdateRoutes were not called when Diagram.LayoutCompleted is raised at tab-switch. Thanks for your help, Walter.