Skip to main content
Bar

BarManagerAppearances.MainMenuAppearance Property

Specifies appearance settings for items in main menus in different visual states.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public StateAppearances MainMenuAppearance { get; }

Property Value

Type Description
StateAppearances

A StateAppearances object that contains appearance settings.

Remarks

The BarAndDockingController allows you to specify appearance settings for items in menus and bars on all forms in the application. Use the controller’s AppearancesBar property to access the following appearance settings:

  • BarAppearance — appearance settings used to paint items in bars in the Normal, Hovered, Disabled, and Pressed states.

  • MainMenuAppearance — appearance settings used to paint items in main menus in different states.

  • StatusBarAppearance — appearance settings used to paint items in status bars in different states.

The code below shows how to use bold for items in the main menu.

image

barAndDockingController1.AppearancesBar.MainMenuAppearance.Normal.Font = 
    new System.Drawing.Font("Tahoma", 7.875F, System.Drawing.FontStyle.Bold);
barAndDockingController1.AppearancesBar.MainMenuAppearance.Normal.Options.UseFont = true;

See the following help topic for more information on how to specify appearance settings: Appearances.

A bar’s BarAppearance property allows you to override these appearance settings for individual bars. To override appearance settings for an individual item, use the item’s ItemAppearance and ItemInMenuAppearance properties.

See the following topic for more information: Look and Feel.

Example

The code below shows how to specify a background color for bars.

// Use the DefaultBarAndDockingController component to access the default controller.
defaultBarAndDockingController1.Controller.AppearancesBar.BarAppearance.Normal.BackColor = Color.Red;
// You can also assign a custom controller to a manager.
barManager1.Controller = barAndDockingController1;
// The BarAppearance property specifies appearance settings in multiple states.
// Use the Normal property to specify appearance settings in the normal state.
barAndDockingController1.AppearancesBar.BarAppearance.Normal.BackColor = Color.Red;
// You can also use the Bar property to specify appearance settings in the normal state.
barAndDockingController1.AppearancesBar.Bar.BackColor = Color.Red;
// The BarAppearance property specifies appearance settings in multiple states.
// Use the Normal property to specify appearance settings in the normal state.
bar1.BarAppearance.Normal.BackColor = Color.White;
// You can also use the Appearance property to specify appearance settings in the normal state.
bar1.Appearance.BackColor = Color.White;
// You can also specify a particular bar's appearance settings.
barButtonItem1.ItemAppearance.Normal.BackColor = Color.White;

Note

Skins use brushes or images to fill the background. The actual behavior depends on the skin. The background color is not in effect if the skin uses an image to fill the background.

See Also