I wonder if it is possible to put different colors (or other properties) on a link? For example the first half of the pipe should be blue, the other half should be red…
The problem is that any property of any object, including a LinkShape, can only have one value at a time. So you have to use two separate LinkShapes, each extending for half of the route.
If the route is such that there is no overlap of bounding areas between the two halves of the route, then one possibility would be for the Link to be a LinkPanel holding two LinkShapes each of which were clipped to show only half. But if the halves of the route might overlap each other, this might not work. And even if they don’t, there still would need to be a custom LinkPanel to arrange the clipping areas correctly.
Another solution would be to use a tiny transparent (but still Visible) Node that connects the two Links holding the two LinkShapes. However that tiny connector Node would not automatically move to follow the normal route between the two normal Nodes that you want to connect. So there would need to be some mechanism by which that transparent connecting Node is positioned the way that you would want.
Thank you for your quick support. I have tried your suggestion (in the Piping demo application). The link panel has two link shapes (see XAML code below). The result is that the pipe has an ‘outside’ color yellow, and ‘inside’ color red. My expectations were that, say if the pipe was 100 meters, the first 50 meters could get one color, the last 50 meters could get the other color. Is this possible?
<go:LinkShape Stroke="Yellow" StrokeThickness="10"></go:LinkShape> <go:LinkShape Stroke="Red" StrokeThickness="5"></go:LinkShape> <!--<go:LinkShape Stroke="Pink" StrokeThickness="2"></go:LinkShape> <go:LinkShape Stroke="Yellow" StrokeThickness="2"></go:LinkShape>--> <Path go:LinkPanel.ToArrow="Triangle" Fill="Black" /> </go:LinkPanel> </DataTemplate>
Maybe – my first suggestion was to customize the LinkPanel so that it clipped one LinkShape to only show the first half of the route, and to clip the other LinkShape to only show the second half of the route. But I haven’t tried to implement this to see if it is feasible.
Given the potentially contorted routes that links in that sample can have, using clipping to hide half of each LinkShape probably cannot work. I think you are going to have to use two separate Links connected by a tiny transparent Node.
Using tiny nodes works, but the multiple links that should appear as one link are separated by these tiny nodes.
The nodes have these properties
Width = “1” Height=“1” Visibility=“Hidden”
I have tried to set Width/Height to “0”, but that approach made the links disappear.
Try setting the Width and Height = “0.01”.