Maintain Constant StrokeThickness across all Zoom levels


Is there a way to maintain constant stroke thickness value for the Links across all zoom levels?
So if i Zoom in a Diagram, the link’s stroke thickness should not be increased or decreased for zoom out.

There are several ways of achieving what you want. I’m not sure which technique would be appropriate for your app.

  1. Implement a DiagramPanel.ViewportBoundsChanged event handler. As the value of DiagramPanel.Scale changes, run through all of the Diagram.Links and change the StrokeThickness of the Link.Path to a value divided by the current DiagramPanel.Scale. I think you’ll need to remember the Scale for the next time, so that you can tell when it’s changed, and not something else to cause the ViewportBounds to change, such as a scroll or change in size of the Diagram.

  2. If you also want to keep each node at the same apparent size, you don’t want to have zooming change the DiagramPanel.Scale at all. Instead, you just want to change the spacing between the nodes. You can do that by modifying the Node.Location for every node. This is discussed at Controlling element sizes when zooming.

Thanks Walter. With Solution 1, i can able to achieve the expected behaviour.