ChildNodes Sequence


I want to change sequence of my child nodes.
Like for example, currently my child nodes are arranged as A,B,C. Now I want to rearrange them or we can say change their sequence to (B, C, A), do we have any way to do this??


Are you using TreeLayout or GridLayout or CircularLayout? If so, you can set the Sorting and Comparer properties.

I am using TreeLayout. As you said I can do it using Sorting, but sorting should be applied on some property(eg: Sequence Number).
I want to know how is it actually decided which node will come first and which one will be second. Is it Key based. If it is so, then interchanging keys will work for me or not??
Please let me know!!


You can implement arbitrarily complex comparison functions in the value you supply to the Comparer property (and/or AlternateComparer property).

The comparison function takes two TreeVertex objects, so you’ll probably want to look at the TreeVertex.Node.Data, safely casting to whatever model data class that you are using.

Do we have any sample for the same??? It would be easier for me to understand.


Look in the TLayout sample.