Model is not modifiable - Cannot add node

Dear all,

i'm new user of goxaml and yesterday I download for the first time trial version. It seems to me very interesting, but I've a simple question.
I'm working on entity relationship example and I added it as user control in my window wpf.
I added to EntityRelatioship.xaml file create method like seen in documentation
public Node ConnectToNewNode(Node cStartNode) { Entity cFromData = cStartNode.Data as Entity; if (cFromData == null) return null; this.myDiagram.StartTransaction("Nuovo nodo aggiunto"); Entity cToData = new Entity(); cToData.Text = "new node"; cToData.Location = new Point(cStartNode.Location.X + 250, cStartNode.Location.Y); myDiagram.Model.AddNode(cToData); myDiagram.Model.AddLink(cFromData, null, cToData, null); this.myDiagram.CommitTransaction("Nuovo collegato"); Node cToNode = this.myDiagram.PartManager.FindNodeForData(cToData, this.myDiagram.Model); return cToNode; }

when in the window I try to add a new node

List<Entity> cEntities = (List<Entity>)m_cERModel.myDiagram.Model.NodesSource; Node cNodeStart = new Node(); cNodeStart.Data = cEntities[0]; m_cERModel.ConnectToNewNode(cNodeStart);
it gives me error:
model is not modifiable - cannot add node
and it happens at
myDiagram.Model.AddNode(cToData);
Please help me

By default models are not modifiable.
You just need to set DiagramModel.Modifiable = true.

However, you don’t want to create a new Node().
(At least not when you mean for that Node to be data-bound.)
Your method really ought to only be working on the model and model data, not on FrameworkElements such as Nodes.

When you add a new Entity to the model’s NodeSource collection, the Diagram.PartManager will automatically create a new Node that is data-bound to that Entity data object and add it to the Diagram.

Thanks I solved following your help ! :)