Hello, I don’t want to refresh the whole diagram every time I add a new node to it. I’m using LayeredDigraphLayout and to avoid refreshing I thought it would be enough to set the Conditions to “None”.
<go:Diagram.Layout>
<go:LayeredDigraphLayout Direction="90" LayerSpacing="{Binding ChartOptions.LayerSpacing}"
ColumnSpacing="{Binding ChartOptions.ColumnSpacing}" Iterations="10" Conditions="None"
/>
</go:Diagram.Layout>
It worked fine when I copy/paste an Element. The new pasted Element is added to the Diagram and the refreshing won’t be carried out.
But when I try to add an Element to the Diagram (I have a button that adds Elements to the Diagram) using:
networkDiagram.StartTransaction("Adding new Element");
networkDiagram.Model.AddNode(myNode);
networkDiagram.CommitTransaction("Added new Element");
The diagram won’t be refreshed (that’s ok).
It adds the new node to the networkDiagram, but the new node WON’T be added to the Diagram(Chart), the new node cannot be seen in the Diagram although it has been added to the networkDiagram.
Has that something to do with the LayeredDigraphLayout --> Conditions that I set?
LoadFromXML method will be called and its input xmlContainer is the transformed object to XML (where the new node was correctly added)
public void LoadFromXML(XContainer xmlContainer)
{
var model = networkDiagram.Model as GraphLinksModel<MyNodeData, String, String, MyLinkData>;
try
{
networkDiagram.LayoutCompleted += LoadLinkRoutes;
networkDiagram.PartManager.UpdatesRouteDataPoints = false;
model.Load<MyNodeData, MyLinkData>(xmlContainer, "MyNodeData", "MyLinkData");
model.Modifiable = true;
model.HasUndoManager = true;
model.Changed += DiagramModelChangedHandler;
networkDiagram.Model = model;
}
catch (Exception e)
{
log.Warn("Loading of XML Failed", e);
}
}
If I don’t set any Conditions to the LayeredDigraphLayout, the Diagram (Chart) will be refreshed and the new node will be added to the Chart, the new node can be seen in the diagram. But I don’t want to refresh the whole Diagram every time i add a new node because all the changes done by the user will be gone. Is there any way to do that?
Thanks