Skip to main content
A newer version of this page is available. .
Bar

BarManager.MainMenu Property

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

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v20.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DefaultValue(null)]
[DXCategory("Behavior")]
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.

Remarks

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.

The following code snippets (auto-collected from DevExpress Examples) contain references to the MainMenu property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also