How to get the nodes connected by a given connection

Hello, guys.
When I select an Element (node) in a diagram, I need to make on a different color the elements (nodes) that are connected with the one selected.
I tried in different ways, but I don't find how to "see" the node objects connected to that selected element
Can you please tell me how to do it?
Thanks

3 Replies 1 reply marked as answer

AR Aravind Ravi Syncfusion Team September 14, 2020 11:33 AM UTC

Hi Giovanni, 

We have created a sample to change the node color which is connected to other node. When you click on the node, NodeClick event gets triggered. In that event, through event args Node you can get the node on which you clicked. After get the node through node Edges property you get the connector which is connected to the node. By using the connector , we get the node which is connected to connector through FromNode property. Please refer to below code snippet and sample below 

private void EventSink_NodeClick(NodeMouseEventArgs evtArgs) 
       
            if(evtArgs.Node.Edges != null) 
           
               foreach ( ConnectorBase connector in evtArgs.Node.Edges ) 
               
                    (connector.FromNode as FilledPath).FillStyle.Color = Color.Red; 
               
           
       


We have attached a video demonstration of how color has been changed.  


Regards 
Aravind Ravi 




Marked as answer

GG Giovanni Guarino September 14, 2020 11:49 AM UTC

It words.
Very appreciated especially the fast answer. Thank you very much!


AR Aravind Ravi Syncfusion Team September 15, 2020 04:42 AM UTC

Hi Giovanni, 

Thanks for the update. 

Regards 
Aravind Ravi 


Loader.
Up arrow icon