Need to find out when user has finished drawing a new connection

Hi,

When I put the diagram into a connection drawing mode with the following code

diagram.DrawingTool = DrawingTool.Connector;
diagram.Tool = Tool.DrawOnce;
How do I find out when the user has finished drawing the connection? 
I need to add custom annoation and decoraters once the user has created the new connection. I can see a new connection begin created in the view models but can't find anything that lets me know when the operation has completed! 

Is there a event to bind to, to find this out? 
I did try binding to the PreviewMouseLeftButtonUp event but this breaks the diagram control. 

Any ideas? Thanks.

3 Replies

SS Suresh Shanmugam Syncfusion Team January 8, 2018 10:12 AM UTC

Hi Daniel, 
 
Requirement : “How do I find out when the user has finished drawing the connection?” 
 
ObjectDrawn event occurs when draw the objects(Node/Connector) on Diagram Page. In this event, we can identify the drawing state of the objects using State argument and also identify, which object is drawing on Diagram Page using the Item argument. 
 
Please find the code example as below to identify the completed state of the Object  
 
Code example , 

 
//Hook the ObjectDrawn event 
(diagram.Info as IGraphInfo).ObjectDrawn += MainWindow_ObjectDrawn; 
 
void MainWindow_ObjectDrawn(object sender, ObjectDrawnEventArgs args) 
{ 
       if (args.State == DragState.Completed) 
       { 
       } 
} 
 

Regards,
Suresh Shanmugam
 



DP Daniel Pamich January 10, 2018 12:19 PM UTC

Brilliant, just what I needed. Thank You!!


SS Suresh Shanmugam Syncfusion Team January 11, 2018 12:51 PM UTC

Hi Daniel, 
  
Thanks for the update. 
  
Regards, 
Suresh Shanmugam 


Loader.
Up arrow icon