You need to adjust the LayeredDigraphVertex.Focus to be near the top of the vertex/node.
[code] public class CustomLayout : LayeredDigraphLayout {
public CustomLayout() {
this.Direction = 90;
}
public override LayeredDigraphNetwork MakeNetwork(IEnumerable<Node> nodes, IEnumerable<Link> links) {
var net = base.MakeNetwork(nodes, links);
foreach (var v in net.Vertexes) v.Focus = new Point(0, 0);
return net;
}
}[/code]
The default vertex focus is at the center.
But remember that the above just controls where the layout will position the nodes. The actual link points are governed by the bounds of the ports and the FromSpot and ToSpot values. To make sure that each of the links connect just below the top of each node, you’ll probably want to set the go:Node.FromSpot=“1 0 0 15” and go:Node.ToSpot=“0 0 0 15”, or something like that.
By default the whole node is a port. If you set go:Node.LinkableFrom=“True” and go:Node.LinkableTo=“True”, the user will be able to drag from anywhere in the node in order to start drawing a new link. You probably don’t want that, so you probably want to put all four of these port properties on the Rectangle that you are using, and to set go:Node.PortId="" on that Rectangle. That means that links will connect to that Rectangle and the user can only draw links from/to that Rectangle.
If you only want the user to be able to draw a new link from along the edge of the Rectangle, put a transparent-filled Rectangle in front of that port Rectangle that is centered on the same Rectangle but is a bit smaller, thereby exposing the port only along the edges. Or you can do what the StateChart sample does – re-use the TextBlock as the non-port object that obscures most of the node from being a place to start drawing a new link.