Change key of link

Hello. I want change a key a link before insert in the diagram.

For a node, i’m using: protected override GraphBaseElement CopyNode1(GraphBaseElement nodedata, GraphLinksModel<GraphBaseElement, string, string, GraphBaseLink>.CopyDictionary env)

But for the link de copylink1 or 2 does not work.

Someone knows the method to do this?

Thanks in advance.

I’m having a hard time understanding what the problem is and what you want to do.

GraphLinksModel.CopyLink1 and .CopyLink2 do get called during the copying process. CopyLink2 is responsible for updating the references to the "from" and "to" node data.
It is uncommon to have to override these methods.

The problem is: I want have a custom key for the links of the diagram.

When i insert a link between two nodes i want asign a custom name, by example “link1”, after, if i insert another link, “link2” …

For the nodes with de CopyNode1 i was lograted, but i need the same with the links.

Can you generate identifiers in the constructor?

Or if you need to do so in the context of the model, you could implement a GraphLinksModel.Changed event handler that looked for the case where the Change == ModelChange.AddedLink.
An alternative equivalent behavior is to override the model’s OnChanged method.

Hello I was assigned a counter in the constructor and work fine.