Problems with link routes

Hello,

we noticed several problems regarding link routes in GoXam for WPF with MVVM approach.

  1. Assume I have 3 nodes on my diagram, and each has one input and one output port. I draw a link between output of node A to input of node B, and reshape the default route. All is good at this point. Then, I draw another link, between output of B to input of C. The first link jumps back to its default route.

  2. In our application, we save diagram data to database. This data includes serialized link routes. Upon loading a saved diagram, the data is converted to actual diagram model data (deriving from GraphLinksModelLinkData<NodeKey, PortKey>). The information is correctly deserialized and assigned to Points property of this object, and subsequently, assigned to appropriate Link in custom CommandHandler’s event handler for Diagram.LayoutCompleted event. However, sometimes some of the links are drawn incorrectly, i. e. with their default routes. This only happens the first time GoXam is initialized in the application. Also, when the application window is maximized, the links seem to be drawn correctly.

  3. There is another problem with the links, not directly connected to routing. Our links have custom templates, involving additional FrameworkElements on the LinkPanel. Those elements are bound to certain properties on the ViewModel of the link, which dynamically change during application runtime. As a result, the links are often rendered incorrectly - parts of the path disappear, while the other elements are displayed correctly, as seen in this video:
    https://onedrive.live.com/embed?cid=900E220351101D9B&resid=900E220351101D9B!69049&authkey=AKJbfWnOiOwYSF8

I’m wondering if the first two problems are being caused by a layout being performed, which results in the link routes being reset to their standard paths. Do you have a Diagram.Layout? If so, I think the addition of the new link (in your #1 problem) invalidates the layout, causing it to be performed again. By default that happens whenever a node or a link is added or removed.

You can change that behavior by setting DiagramLayout.Conditions to include only the flags that you want. In fact, maybe you just want to set Conditions=“None” on your layout and then only perform a layout when you (or the user) decides to, by calling Diagram.LayoutDIagram().

The independent problem involving the updating of FrameworkElements on Links is due to how we implemented Links in a more efficient fashion than the normal FrameworkElements such as Nodes. You can explicitly call Part.Remeasure() on such Links.