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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to remove connections from a node?

Thread ID:

Created:

Updated:

Platform:

Replies:

73614 May 13,2008 08:37 AM UTC Jul 21,2008 01:39 PM UTC WinForms 3
loading
Tags: Diagram
Administrator [Syncfusion]
Asked On May 13, 2008 08:37 AM UTC

Hi,

When I remove a node, I want to remove all connections (created by PolyLinkLine) connected to one of the ports of my node as well. I remarked that in the EventSink_NodeCollectionChanging(), the information of which connection is linked to my node is already gone...

Thank you for your advice,
Stefan.


Fathima Shalini P [Syncfusion]
Replied On May 22, 2008 11:27 AM UTC

Hi Stefan,

Thank you for your interest in Syncfusion Products.

To delete node with link we need to use EventSink_NodeCollectionChanged event. Please find the following code snippet that illustrates this:


void EventSink_NodeCollectionChanged(CollectionExEventArgs evtArgs)
{
LineConnector line; Node tonode, fromNode;
Node m_node = evtArgs.Element as Node;
if (m_node is Node)
{
if (evtArgs.ChangeType == CollectionExChangeType.Remove)
{
IEnumerator enumnodes = this.myDiagram1.Model.Nodes.GetEnumerator();
NodeCollection links = new NodeCollection();
while (enumnodes.MoveNext())
{
Node node = enumnodes.Current as Node;
//Determine if the node is of type Link
if (node.GetType() == typeof(Syncfusion.Windows.Forms.Diagram.PolyLineConnector))
{
line = node as PolyLineConnector;
tonode = line.ToNode as Node;
fromNode = line.FromNode as Node;
if (tonode == null || fromNode == null)
{
this.myDiagram1.Model.RemoveChild(line);
}
}
}
}
}
}


Please refer the below sample in the following link:

http://websamples.syncfusion.com/samples/Diagram.Windows/46162/main.htm

Please let me know if any concerns.

Regards,
Fathima


Truman Lackey
Replied On July 18, 2008 05:49 PM UTC

I believe there is a problem with this code if there is a symbol with only a connection on one end (I'll call it dangling) or a link line with no connections. Any links/lines with these properties will also be removed. I have tried doing something following the old example here
http://www.syncfusion.com/support/forums/message.aspx?MessageID=20459
but the edges seem to be removed from the node before the event gets fired.

An update on how to remove links coming in and out of node is needed.


J.Nagarajan [Syncfusion]
Replied On July 21, 2008 01:39 PM UTC

Hi Truman ,

We regret for the incovenience caused. I was able to see the issue "Node.Edges returns null when the LineConnector is exist" in 6.3.0.30. I have logged a defect report in this regard. I have forwarded this issue to our developers for more analysis. I will get back to you with more details regarding this issue on or before 23rd July,2008.

Thanks for your patience.

Regards,
Nagaraj


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;