Moving group node and child nodes at same time

I use Northwoods.GoSilverlight with Subscription with Source License.

I want to moving parent group node and child nodes
when dragging any child node.

At first glance I thought that just making the child nodes not Selectable would get you what you want. But that has two disadvantages:

  • you might want to allow the user to select those child nodes
  • nested groups could still be selected and moved within their containing group
    You didn’t say whether those limitations were important to you.

You also didn’t say what to do when the user selects a link.

So the more general solution is to customize how the DraggingTool chooses which Parts it drags.

public class GroupDraggingTool : DraggingTool { public override Dictionary<Part, DraggingTool.Info> ComputeEffectiveCollection(IEnumerable<Part> parts) { var toplevels = new HashSet<Part>(); foreach (Part p in parts) toplevels.Add(p.FindTopLevelPart()); return base.ComputeEffectiveCollection(toplevels); } }
To install, replace the standard DraggingTool with this custom one.
You can do that either in code:

    myDiagram.DraggingTool = new GroupDraggingTool();

or in XAML:

<go:Diagram . . .> <go:Diagram.DraggingTool> <local:GroupDraggingTool /> </go:Diagram.DraggingTool> </go:Diagram>

(*_+) Thank you walter. It’s solved .