Lock part of the graph

Feb 14, 2013 at 1:40 PM
Is it possible in some way to lock position of the part of the graph? I want to add vertices in the runtime, and layout them accordingly to selected algorithm, but somehow lock the position of already positioned vertices.
Coordinator
Feb 14, 2013 at 4:14 PM
Yes. Do this:
  1. Select the vertices you want to lock. (Alternatively, select the vertices you don't want to lock, then right-click the graph pane and select Toggle Selection from the right-click menu.)
  2. Right-click the graph pane and select Edit Selected Vertex Properties.
  3. In the Vertex Properties dialog box, set Locked? to Yes and click OK.
The locked vertices will now stay in place when you refresh the graph.

-- Tony
Feb 15, 2013 at 8:59 AM
Thank you very much for your reply, Tony. I'm sorry, I forgot to mention, that I want to do it in the NodeXLControl in WPF. I cannot find "Locked" property in the NodeXLControls.Graph.Vertices or anywhere else
Coordinator
Feb 15, 2013 at 4:06 PM
Aha, that changes the answer.

It's not a property, it's a metadata key.

For each vertex you want to lock, do the following before telling the NodeXLControl to draw the graph:
vertex.SetValue(ReservedMetadataKeys.LockVertexLocation, true);
The following is from the "ReservedMetadataKeys.LockVertexLocation Field" topic in the NodeXLApi.chm help file:
"Key added to a vertex to tell the layout algorithm to leave the vertex at its current location."  "The key's value is a Boolean."
-- Tony
Feb 19, 2013 at 9:01 AM
Thank you, that solved all my problems)