Bar

BarItem.ItemAppearance Property

Specifies appearance settings for this item in different states.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v21.1.dll

Declaration

[DXCategory("Appearance")]
public virtual BarItemAppearances ItemAppearance { get; }

Property Value

Type Description
DevExpress.XtraBars.BarItemAppearances

An 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 and AppearancesRibbon properties to specify appearance settings in bars and ribbons.

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.

Note

The size of an item in a bar or ribbon depends on the size of its caption. However, if you change the font size of a particular item in a ribbon, the item’s size does not change. This helps to maintain the same size for all items. To change the size of items in a ribbon, you must use the controller’s AppearancesRibbon property.

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