Detachable Command bar in Windows Forms Menu (Menus)

The CommandBar instance can be added to the menu bar and can be set to detach from the parent menu bar.

Adding command bar via designer

The command bar can be added via the DetachedCommandBars selection from the smart tags options. The below image shows the command bar is added to the menu via the designer settings.

Command bar added to the bar

Form loaded with command bar

Adding command bar via code

The command bar instance should be created with required settings and added to the DetachedCommandBars collection property. The below code snippet shows the command bar is added to the menu control with top docked position.

this.commandBar1 = new Syncfusion.Windows.Forms.Tools.CommandBar();
this.commandBar1.DockState = Syncfusion.Windows.Forms.Tools.CommandBarDockState.Top;
this.commandBar1.Name = "commandBar1";
this.commandbar1.Text = "Command bar1";

this.mainFrameBarManager1.DetachedCommandBars.Add(this.commandBar1);
Dim commandBar1 as New Syncfusion.Windows.Forms.Tools.CommandBar()
Me.commandBar1.DockState = Syncfusion.Windows.Forms.Tools.CommandBarDockState.Top
Me.commandBar1.Name = "commandBar1"
Me.commandbar1.Text = "Command bar1"

Me.mainFrameBarManager1.DetachedCommandBars.Add(Me.commandBar1);

Form loaded with command bar

See Also

Hosting controls in command bar