Back to Devexpress

BarManager.MainMenu Property

windowsforms-devexpress-dot-xtrabars-dot-barmanager-6c64f11d.md

latest2.7 KB
Original Source

BarManager.MainMenu Property

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

Namespace : DevExpress.XtraBars

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(null)]
[DXCategory("Behavior")]
public virtual Bar MainMenu { get; set; }
vb
<DXCategory("Behavior")>
<DefaultValue(Nothing)>
Public Overridable Property MainMenu As Bar

Property Value

TypeDefaultDescription
Barnull

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.

See Also

StatusBar

CanDockStyle

DockStyle

BarManager Class

BarManager Members

DevExpress.XtraBars Namespace