Using the following code to add a few copies of a user control to a panel:
ucMenuItem lo_MenuItem = new ucMenuItem();
lo_MenuItem.InitMenuItem(“New Batch”, “resource.wx/Wisej.Ext.FontAwesome/plus-square-o.svg?color=#F36736”, “Add”);
lo_MenuItem.MenuClicked += Lo_MenuItem_MenuClicked;
lo_MenuItem.Width = pnl_LeftMenu.Width;
lo_MenuItem.Dock = DockStyle.Top;
this.tt_Desktop.SetToolTip(lo_MenuItem, “Add a new batch”);
pnl_LeftMenu.Controls.Add(lo_MenuItem);
//pnl_LeftMenu.Controls.SetChildIndex(lo_MenuItem, 0);
if I’m adding lets say 5 of these above with different menu item names, they appear in the opposite order that I add them.
Is there a setting to make them go in order that they are added, or do I need to add them in reverse order ?
It’s not backward, it follows the z-index order like in winforms. You can change it using BringToFront, SendToBack, or Controls.SetChildIndex.
I tried using SetChildIndex(its now commented out) – trying ascending and descending values – it didn’t make a difference, the controls were rendered in reverse order they were added to the panels.
Please login first to submit.