/// <summary> /// Сортирует дочерние элементы по порядку (Order) /// </summary> public void SortRecursive() { var lst = new List <FlexNode>(); foreach (var node in ChildList) { lst.Add((FlexNode)node); } lst.Sort(CompareFlexNodesRecursive); foreach (var node in lst) { var lstInner = new List <FlexNode>(); foreach (var nodeInner in node.ChildList) { lstInner.Add((FlexNode)nodeInner); } lstInner.Sort(CompareFlexNodesRecursive); node.SortRecursive(); } ChildList.Clear(); ChildList.AddRange(lst); }