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

Add new Connection event

Hi there,
I'm evaluating Syncfusion Diagram Windows and I have a question about the best way to get and event when two nodes have been connected by a connector.
I would like an event which argument(s) that specify newly connected nodes.
I tried

this.diagram1.Model.EventSink.ConnectionsChanged += new CollectionExEventHandler(EventSink_ConnectionsChanged);

but it fires twice, for both connected nodes.

thank you
domenico

3 Replies

DM Dinesh M Syncfusion Team November 30, 2009 03:43 PM UTC

Hi Domenico,

Please try the following code and let me know whether it solves your problem. The event occurs twice as there are two connection points for a connector.

diagram1.Model.EventSink.ConnectionsChanged += new CollectionExEventHandler(EventSink_ConnectionsChanged);

void EventSink_ConnectionsChanged(CollectionExEventArgs evtArgs)
{
if (evtArgs.ChangeType == CollectionExChangeType.Insert)
{
//NodeCollection nodes = evtArgs.Elements as NodeCollection;
EndPoint conPoint = evtArgs.Element as EndPoint;
ConnectorBase con = conPoint.Container as ConnectorBase;
if (con != null && con.FromNode != null && con.ToNode != null)
{

}
}
}

Regards,
Dinesh


DM Domenico Mozzone December 1, 2009 08:15 AM UTC

Hi Dinesh,
thank you very much for you help.
Best Regards
Domenico


DM Dinesh M Syncfusion Team December 1, 2009 12:47 PM UTC

Hi Domenico,

Thanks for the update.

Regards,
Dinesh

Loader.
Live Chat Icon For mobile
Up arrow icon