Is there a function to force the Diagram redraw all the Nodes/Links?
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.
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.
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.
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.