Customized Tree View with Bounds for Nodes

I’m trying to achieve the following tree layout

The thing is there are a specific number of categories (the 3 shaded layers in the pic) and a node belongs to a particular category, so when a tree layout operation is being done, a node should be placed in the respective category to which it belongs to.

How can this be done ?

This is just a standard tree with a really long distance between the 2nd and 3rd rows. Is it possible the node on the bottom right could be in a different layer than the 3 on the left, even though it’s at the same level in the tree?

Actually the number of categories will vary, in this pic, there are 3

And there could be multiple child nodes inside a particular category, This pic should illustrate what I’m trying to say -

Also since the User would have the option to insert new nodes during runtime, it’d be difficult to distribute the nodes among different layers without some complex logic involved…

Would it be possible to override TreeLayout in such a way as to restrict the locations of various nodes according to the category to which they belong to and then perform a normal tree layout ?

Well, this way of extending GoLayoutTree:

public class LayoutTreeWithSpecialLayerAssignment : GoLayoutTree
protected override void AssignTreeNodeValues(GoLayoutTreeNode n) {

  GoBasicNode node = n.GoObject as GoBasicNode;
  if (node != null) {
    if (node.Text == "2") {
       n.LayerSpacing = n.LayerSpacing * 2 + node.Height;
       node.Brush = Brushes.Yellow;


will give you this (note the node with the label “2”)

and maybe that’s enough (n.Level will tell you the layer in the tree that node was computed to be at)

But… it seems to me there might be another (simpler?) way. Let the normal tree layout run. Then, recurse down through the tree, and for each node (in this case “4”, “5” and “6”) you would “detect” that they aren’t in the right category/layer by Y position, and you simple do a “move tree” of that node and all it’s children down to the right Y position. (TreeApp has some code for moving a whole subtree.)

I haven’t tried that, but it seems straightforward.

The last suggestion seems like a good idea, the ‘Move tree’ functionality works only for User input ie. the user clicking and dragging the node, so I’ll have to look into moving all child nodes when moving a specific node.


You can steal the code in TreeDraggingTool to build the collection of nodes you need to move. Â Just start with a GoCollection that is the root and call AddSubtrees to build the collection.

Then, just iterate the collection and bump the Y position.