Articles in this section
Category / Section

How to establish the connection when a node is dropped on a connector

1 min read

We have a support to connect with the Node which is dropped on a Connector. This can be achieved by using ItemDropEvent for the Diagram. This Event will get invoke with Source and Target (Collection of Intersected Elements) of Intersection. We have provided code example for this.

 

Please refer to the code example as below.

C#

//ItemDropEvent for Diagram
IGraphInfo sfdiagram = (diagram.Info as IGraphInfo);
sfdiagram.ItemDropEvent  += Diagram_ItemDropEvent;
 
//ItemDrop Event 
private void Diagram_ItemDropped(object sender, ItemDropEventArgs args)
      {
      if(args.Source is Node && args.Target!=null)
           {
                foreach(var con in args.Target as List<object>)
                {
                    if(con is IConnector)
                    {
                        (con as IConnector).SourceNode = args.Source;
                    }
                }                
            } 
      } 
Here,
diagram   –   refer to the instance of Diagram.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied