Bar.BarAppearance Property

Specifies appearance settings for items in this bar in different states.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v21.1.dll

Declaration

public virtual StateAppearances BarAppearance { 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:

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

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