You can grab a reference to the parent control, and re-add the controls in the order you want:
var parent = menuItem1.Parent;
parent.Controls.Add(menuItem2);
parent.Controls.Add(menuItem1);
parent.Controls.Add(menuItem3);
In this example, the divs
will be reordered to menuItem2
, menuItem1
, menuItem3
. Note that this will also move them to the end if there are other controls already in the same container. If you want more control over the placement, you can use .Controls.AddAt
to add at a specified index.