Detachable Command bar in Windows Forms Menu (Menus)
3 Sep 2020 / 1 minute to read
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.
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);