We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

set direction of start and endpoint of a link

Hello,

I'm currently evaluating Essential Diagram and I'd like to know if it is possible to specify the link direction at a port. I managed to work out an example, where a symbol exactly has the same number of ports as links (trivial for you I think). Now I want to specify that specific ports, let's say the ports are at the top of the symbol, only allow links with a vertical first segment.

Do I have to implement such a feature by myself, or is it possible to modify a implemented class for this purpose?

Thank you for your comments,

Alex

1 Reply

J. J.Nagarajan Syncfusion Team November 28, 2006 05:44 PM UTC

Hi Alexander ,

Thanks for your interest in Essential Diagram. If your intention is to draw links to the ports at the top of the symbol then please refer to the following code snippet

//In Initialize component
this.diagram1.Model.LineRoutingEnabled=true;

//In AddLink Button click event
LinkCmd linkcmd = new LinkCmd();
for (int i = 0; i <=4; i++)
{
Link link = new Link(Link.Shapes.OrthogonalLine);
linkcmd.SourcePort = rectangle.Ports[i];
linkcmd.TargetPort = roundrect.Ports[i];
linkcmd.Link = link;
this.diagram1.Controller.ExecuteCommand(linkcmd);
}

Please refer to the attached sample. In this sample when you click on "AddSymbols" button you can load 2 symbols and when you click on the "Add Link" button then the link should be connected only on to ports on the top of the symbols.

I hope this will meet your requirement. Please give us some more details about your requirement or provide us some screen shots if this doesn't helps.

Regards,
Nagaraj

Dynamic Link.zip


Loader.
Live Chat Icon For mobile
Up arrow icon