Redraw the whole Diagram or a Node/Link

Is there a function to force the Diagram redraw all the Nodes/Links?

What function do I need to call to redrawn a Node/Link?
Thanks a lot!

That depends on what you mean by “redraw”.

Perhaps you want to call myDiagram.PartManager.RebuildNodeElements. That just discards all of the diagram’s Nodes and Links, adds all of the Parts from the PartsModel, and then creates new Nodes and Links from the Model data.

For an individual data-bound Part, I suppose you could remove it and then add it back. That means calling PartManager.[Add/Remove][Node/Link]ForData.

Or perhaps you only want to invalidate the visual appearance, remeasure, and rearrange the Part. If so, call Part.Remeasure().

I think the real question is why you need to do this at all.

Thanks, Walter.

What I want to do is to invalidate the visual appearance because I changed the size of the node somehow. The first and second way work fine. But if I just call Part.Remeasure(), the Node is not updated.
What I am looking for is a function similar to Remeasure(). Is there such a function available? Otherwise, I have to Add/Remove Node for data.

I think how you change the size of the node matters. How are you doing that? What element are you changing?

I have an Expander in the NodePanel and a ListView inside the Expander.

I can enlarge the whole Expander(Node) by dragging the column header of the ListView control.
The problem is that I try to drag the ListView header splitter to make the Expander smaller. I try to call Remeasure the Node in Collapsed event handler of the Expander. My purpose is that when the Expander is expanded again, the Node is redrawn and the size is smaller.
But the Node keeps the same size after I call Remeasure function. It do changes the size after move some Nodes which link to it.
I can't find which function to call to implement it except Remove/Add NodeForData.
Thanks a lot! Merry Christmas and happy new year!

Part.Remeasure just re-measures and re-arranges the whole Part.
It doesn’t necessarily remeasure or rearrange any nested element.

But it’s odd that you say that moving (dragging) the node causes it to resize correctly. I believe that dragging only causes each node to be re-arranged, but not even re-measured.

Does selecting the node (when not already selected) cause it to size correctly? If not, how about selecting and deselecting?

Does the node have the correct size when the node is collapsed?

Have you tried calling Part.Remeasure after expanding?

I have to move the Node that links to it not the Node itself.

Selecting the node doesn't work. But selecting another node and then selecting it again works.
Also, if a new node is drag and drop to the Diagram, the size will change.
The size is correct when the node is collapsed.
I tried to call Remeassure when the node is collapsed, but it doesn't work.

So nothing you do to the expanded node itself fixes it – it’s only doing something to/with some other node???

That’s very odd. My first thought is that there might be some state shared by the primary node that you didn’t expect to be shared. But that’s just wild speculation, trying to come up with a scenario that would produce the results you are seeing.

So now I’m wondering if the initial resizing of the expanded node didn’t really happen in a manner that persists beyond the collapse and expand. You might want to try this in a Window or Page so that there’s no influence from the GoXam Diagram/DiagramPanel/NodeLayer/Node.

Thanks, Walter.

It's the problem of Expander.