Hello,
I will try to clarify what my question is:
If I create a DiagramLink and try to add it using (diagram.Links.Add(newLink), the link is not added to the diagram's link collection. The count remains the same.
The same thing happens if I create a new node and try to add it to the diagram's node collection (diagram.Nodes.Add(newNode). The new node is not added.
Do you know of any reason why the Add methods would not work that I can use to troubleshoot this issue?
In my last code snippet, yes I know that am re-adding the same link. What I actually do is remove that link, modify it (since that link has no Id or Tag or other properties I need), and then try to re-add it to the diagram.
Here is the full code:
public ActionResult ModifyDiagram(string diagramJson, string linkJson)
DiagramView view = DiagramView.FromJson(diagramJson);
jsSerializer.RegisterConverters(new JavaScriptConverter[] { new DiagramLinkConverter(view) });
DiagramLink link = jsSerializer.Deserialize<DiagramLink>(linkJson);
Diagram currentDiagram = view.Diagram;
currentDiagram.Links.Remove(link);
link = AddNewPropertiesToLink(link);
//this does not work!
currentDiagram.Links.Add(link);
My point is that the add method doesn't work, even if I am trying to add the link to a different diagram instance, because I have tried that, too. If you pretend I am adding a brand new link instead of the deserialized one, the result is the same: the link is NOT added to the diagram.
Why might cause the Add methods for links and nodes to fail?
Thanks.