posted 8 years ago
Code below will:
1. Create a separate line with a text below it
2. Ensure that the text always remains under the line and printed in the right direction (left to right with the characters correctly oriented rather than flipping upside down as the line is rotated).
This is just a quick sample code. It uses a lot of binding. Another approach (more general purpose) would be to subclass Labeled and build a custom control with a skin that includes both the line and the label, but that is quite bit more complex, so I don't do that or explain that here.
For your node overlapping point (3. Connections overlap nodes.), the drawing depends upon the order of items in the child list. You can change the order of the items in the child list to change their order of rendering.
So for the code below, the line connection line will be rendered under the start anchor, which is under the end anchor, which is under the distance label. You can set this ordering as below when the parent is created:
Or you can change it later, for example, after the label is the group, to move the label to the back you could either call:
Or