GoCollapsibleHandle

I create a custom GoNode with is collapsible depending if it have the children or not. A GoCollapsiblehandle is added to the node. The problem is when laying out the nodes the nodes are layout but their handles is stay the same place. How do I ensure that each node’s collapsiblehandle position is always the node’s posotion?
Thanks.

Override LayoutChildren in the node class to set the handle’s Position to be the same as the position of another child of the node, or some offset from another child.
Don’t use the node’s Position, since that is normally calculated to include the position of the handle itself. If you already have an implementation of LayoutChildren, this is probably why you are getting the current behavior.

the problem happen after create a subgraph, do layout on the subgraph then the view. I override the layout children and set the GoCollapsibleHandle object Location to the first child of the node, but the problem still happens.
public override void LayoutChildren(GoObject childchanged)
{
base.LayoutChildren(childchanged);
GoCollapsibleHandle handle = childchanged as GoCollapsibleHandle;
if (handle != null)
{
handle.Location = this.First.Location;
}
}

Your code isn’t handling the (most common) case where the child whose Bounds were changed is not the GoCollapsibleHandle, or when the “childchanged” argument is null.