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

BarManager.MainMenu Property

Gets or sets the main menu bar.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v19.1.dll

Declaration

[DXCategory("Behavior")]
[DefaultValue(null)]
public virtual Bar MainMenu { get; set; }

Property Value

Type Default Description
Bar *null*

A Bar object representing the main menu bar. null (Nothing in Visual Basic) if no main menu is owned by this BarManager.

Remarks

The MainMenu property allows you to specify the main menu for the container (form). For this purpose, assign a bar to this property. Such a bar automatically acquires specific properties:

  • It cannot be hidden by an end-user at runtime;
  • It’s stretched horizontally, by default, to fit the container’s width (see BarOptions.UseWholeRow);
  • The item multi-line arrangement feature is enabled by default (see BarOptions.MultiLine);
  • It receives focus when an end-user presses the ALT key;
  • If it belongs to an MDI child window, it is automatically merged with the parent MDI form’s main menu.

To dock a bar to a specific container’s edge, use the Bar.DockStyle property. The Bar.CanDockStyle property allows you to specify possible dock positions for the bar. For instance, you can set this property to BarCanDockStyle.Top and so prevent the bar from being docked to other container’s edges, and from making it floating.

There can be only one main menu on the form.

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