This project is read-only.

Place edges over vertices

Dec 4, 2012 at 2:38 PM

When the graph is created, any vertex will cover an edge if it's put over that edge. I would like to know if there is any way to avoid this, so when I put a vertex over an edge, the entire edge is still visible.

Thanks in advance!

Dec 4, 2012 at 5:23 PM

Try using ZIndex. Your GraphLayout (or the surrounding ZoomControl) needs to be in a Canvas or Grid. Then you just add a higher Canvas.ZIndex property to the EdgeControl style than the VertexControl style, like so:

<Style TargetType="{x:Type graphsharp:VertexControl}">
     <Setter Property="Canvas.ZIndex" Value="1" />
     .....
</Style>
.....
<Style TargetType="{x:Type graphsharp:EdgeControl}">
     <Setter Property="Canvas.ZIndex" Value="2" />
     .....
</Style>
That should make all edges be rendered on top of all vertices. If you just need some of them to be on top, maybe you could have an int property for your custom edge that can be set higher or lower than that of the VertexControls, and then you could bind to it in the EdgeCotrol style.

Dec 4, 2012 at 6:49 PM
Edited Dec 5, 2012 at 10:27 AM

Thank you for the suggestion, I'll try it and leave you some feedback when done! :)

EDIT: It worked perfectly, it was already in a Grid, so I only had to add the code and voilà! Thank you!