Group Location NaN Value

We have a group and node layout as shown in the picture.

Groups have no specific purpose other than to wrap all the nodes inside the group.
Both Groups and nodes can be selected.
All additions of group and node are controlled by external menu commands and not through goxam supported copy/paste means all insert operation are done from code behind and not through diagram.

Whenever a new node is added to a group , it should come at the right side of the bottom right most node already in the group and should stay selected and should be scrolled into view if not in viewport.
So CustomNodeLayout is implemented which adds the node at the bottom right portion of group.
Also CenterNode custom function is implemented which scrolls the node into view after creation.
This works flawlessly.

When a new Group is copy/pasted or inserted, it should come below all existing groups. This is implemented by Group Layout itself which will place the new nodes of the new group below the bottom most group. There is NO DiagramLayout implemented to layout groups. (This is not done because in case both CustomNodeLayout and CustomGroupLayout are implemented, at first CustomNodeLayout.DoLayout is called and then CustomGroupLayout.DoLayout is called. So in the CustomNodeLayout.DoLayout, it is difficult to layout and position nodes in a parent group which is still not laid out.)
This also works fine with the new group appearing below the lowermost group.
But the problem is in the subsequent CenterNode call with the newly added and selected group, the bounds of the new group will return location as NaN and also erroneous Width and Height which fails the CenterNode function. But if we select another group or node and then select this Group again, it gets proper bounds values.

So whenever a new node is added, it is added properly, stays selected and is brought into view,
But whenever a new group with nodes is added, it is added properly, stays selected, but not brought into view.

How can this be resolved?

I think the problem is that because everything in WPF and Silverlight is asynchronous, you have to wait until everything is measured and arranged before you know how big and where everything is. Only then can you decide to scroll the viewport so as to show a particular Part.

So I suggest that you call DiagramPanel.CenterPart or CenterRect in a Diagram.LayoutCompleted event handler.