/// <summary> /// Sort the containers from the list, based on their z-order /// </summary> /// <param name="containers">containers to sort</param> private void SortContainersBasedOnTheirZOrder(List <DockingContainer> containers) { Comparison <DockingContainer> containersSorterHandler = delegate(DockingContainer container1, DockingContainer container2) { if (container1 == container2) { return(0); } int indexView1 = _host.GetZOrderIndex(container1); int indexView2 = _host.GetZOrderIndex(container2); return(Math.Sign(indexView2 - indexView1)); }; containers.Sort(containersSorterHandler); }