Hi
I am adding nodes to diagram area dynamically. The first node is visible properly but the second node is not visible until i change the location of the previously added node.
How can i auto refresh the diagram panel while adding a node?
I am using the below code:
You’re doing a lot of stuff that you don’t need to do or just shouldn’t do.
What data-bindings do you have in your Node DataTemplate?
If you have a data-binding for go:Node.Location, you might just need to do:
[code] myDiagram.StartTransaction(“add node”);
MyNodeData data = new MyNodeData() {
Key = Guid.NewGuid().ToString(), // why not use Guid as your NodeKey type?
Text = “Entity”,
Category = “Standard”,
Figure = NodeFigure.Rectangle,
Location = objPoint,
};
myDiagram.Model.AddNode(data);
myDiagram.CommitTransaction(“add node”);
Node node = myDiagram.PartManager.FindNodeForData(data, myDiagram.Model);
myDiagram.Panel.MakeVisible(node, Rect.Empty);
[/code]