Bar bar = new Bar();
barManager2.Bars.Add(bar);
for (int i = 0; i < menus.Count; i++)
{
BarSubItem subitem=new BarSubItem();
subitem.Caption=menus[i].Name;
subitem.Name=menus[i].Identifier;
subitem.Id = barManager2.Items.Count + 1; ;
subitem.Visibility = BarItemVisibility.Always;
barManager2.Items.Add(subitem);
bar.ItemLinks.Add(subitem);
MultiMenus child=menus[i].SubMenus;
for (int j = 0; j < child.Count; j++)
{
BarButtonItem button = new BarButtonItem();
button.Caption = child[j].Name;
button.Tag = child[j].Identifier;
button.Id = barManager2.Items.Count + 1;
button.Visibility = BarItemVisibility.Always;
subitem.ItemLinks.Add(button);
(button as BarItem).Manager = barManager2;
}
}
bar.DockStyle = DevExpress.XtraBars.BarDockStyle.Top;
barManager2.MainMenu = bar;