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 do I delete all links to a node

Thread ID:

Created:

Updated:

Platform:

Replies:

20459 Oct 19,2004 12:26 PM UTC Jul 21,2008 01:38 PM UTC WinForms 4
loading
Tags: Diagram
Administrator [Syncfusion]
Asked On October 19, 2004 12:26 PM UTC

How do I delete all links that are connected to a node when that node is deleted? TIA

Administrator [Syncfusion]
Replied On October 19, 2004 06:32 PM UTC

Hi As noted in this Knowledgbase article, the Diagram.Model.ChildrenChangeComplete event is fired whenever a new node is added or removed. So you could use the IGraphNode Interface to detemine the links entering and leaving the Symbol and use the RemoveNodesCmd to remove the links when an instance of MySymbol is deleted. Run this sample and add a few nodes and links and select a Symbol (MySymbol) and click on the "Delete Symbols and Links" Button. Here is the code for the Model_ChildrenChangeComplete event: private void diagram1_Model_ChildrenChangeComplete(object sender, Syncfusion.Windows.Forms.Diagram.NodeCollection.EventArgs evtArgs) { if (evtArgs.ChangeType.ToString() == "Remove") { IGraphNode curNode = evtArgs.Node as IGraphNode; if (curNode != null) { IEnumerator enumedgesEntering = curNode.EdgesEntering.GetEnumerator(); IEnumerator enumedgesLeaving = curNode.EdgesLeaving.GetEnumerator(); //RemoveNodesCmd RemoveNodesCmd rmnodesCmd = new RemoveNodesCmd(); //NodeCollection NodeCollection links = new NodeCollection(); //Incoming Links ICollection edgesEntering = curNode.EdgesEntering; while (enumedgesEntering.MoveNext()) { Link incomingLink = enumedgesEntering.Current as Link; links.Add(incomingLink); } //Leaving Links ICollection edgesLeaving = curNode.EdgesLeaving; while (enumedgesLeaving.MoveNext()) { Link leavingLink = enumedgesLeaving.Current as Link; links.Add(leavingLink); } //Concatatenation of the NodeCollection to the RemoveNodesCmd rmnodesCmd.Nodes.Concat(links); //Execute the RemoveNodesCmd this.diagram1.Controller.ExecuteCommand(rmnodesCmd); } } } Regards Arun

Administrator [Syncfusion]
Replied On October 23, 2004 09:43 PM UTC

Thank you for the help.

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

I am trying the following in vs 6.3.0.30

if (evtArgs.ChangeType == CollectionExChangeType.Remove)
{
if (evtArgs.Element is Node)
{
IGraphNode remNode = (IGraphNode)evtArgs.Element;
foreach (IGraphEdge edge in remNode.Edges)
{
this.diagramComponent.Model.RemoveChild((Node)edge);
}
}

}

The issue I am having is that there are no edges in the Edges collection even though a link exist. How should this be done?


J.Nagarajan [Syncfusion]
Replied On July 21, 2008 01:38 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

;