The following changes in ContainerNode.cs will fix that:
Replace the two GetFoldedContainer methods with
/// <summary>
/// Retrieves the topmost folded container node (if any)
/// the specified node belongs to.
/// </summary>
internal static ContainerNode GetFoldedContainer(DiagramNode node)
{
return FindTopmostContainer(node, null,
delegate(ContainerNode c) { return c.Folded; });
}
/// <summary>
/// Retrieves the topmost selected container node (if any)
/// the specified node belongs to.
/// </summary>
internal static ContainerNode GetSelectedContainer(DiagramNode node)
{
return FindTopmostContainer(node, null,
delegate(ContainerNode c) { return c.Selected; });
}
static private ContainerNode FindTopmostContainer(
DiagramNode node, ContainerNode topmost, Predicate<ContainerNode> condition)
{
ContainerNode container = GetContainer(node);
if (container != null)
{
if (condition(container))
return FindTopmostContainer(container, container, condition);
return FindTopmostContainer(container, topmost, condition);
}
return topmost;
}
and in OnDropOver override replace nodes = selection.Nodes.Clone() assignment with
nodes = new DiagramNodeCollection();
foreach (DiagramNode node in selection.Nodes)
if (GetSelectedContainer(node) == null)
nodes.Add(node);
In effect, that should change the parent only of the outermost selected container.
I hope that helps,
Stoyan