Skip to main content

BarManager.MainMenu Property

Gets or sets the bar that is used as the form’s main menu.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v22.1.dll


public virtual Bar MainMenu { get; set; }

Property Value

Type Default Description
Bar null

A bar that is the form’s main menu. null (Nothing in Visual Basic) if there is no main menu on the form.


The MainMenu property specifies the bar that is the form’s main menu. There can be only one main menu on the form.


The main menu has the following specificities:

  • It cannot be hidden at runtime.
  • It is stretched horizontally to fit the form’s width. Use the UseWholeRow property to change this setting.
  • Bar items are arranged in multiple lines if the form width is insufficient. Use the MultiLine to change this setting.
  • It receives focus when a user presses the Alt key.
  • If it belongs to an expanded MDI child window, it is merged with the parent MDI form’s main menu.
  • Drop-down arrows in sub-menu buttons are hidden. Use the AllowDrawArrow property to change this setting.

The Bar.CanDockStyle property specifies the form’s edges where a user can dock the main menu. For instance, if you set this property to Top, a user cannot dock the main menu to any other edge or make it float.

To dock a bar to the form’s specific edge in code, use the Bar.DockStyle property.

See Also