Back to Devexpress

BarManagerAppearances.BarAppearance Property

windowsforms-devexpress-dot-xtrabars-dot-barmanagerappearances-c689c912.md

latest6.7 KB
Original Source

BarManagerAppearances.BarAppearance Property

Specifies appearance settings for items in bars in different visual states.

Namespace : DevExpress.XtraBars

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public StateAppearances BarAppearance { get; }
vb
Public ReadOnly Property BarAppearance As StateAppearances

Property Value

TypeDescription
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.

csharp
barAndDockingController1.AppearancesBar.MainMenuAppearance.Normal.Font = 
    new System.Drawing.Font("Tahoma", 7.875F, System.Drawing.FontStyle.Bold);
barAndDockingController1.AppearancesBar.MainMenuAppearance.Normal.Options.UseFont = true;
vb
barAndDockingController1.AppearancesBar.MainMenuAppearance.Normal.Font =
    New System.Drawing.Font("Tahoma", 7.875!, 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.

csharp
// 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;
vb
' 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

StatusBarAppearance

MainMenuAppearance

Look and Feel

BarManagerAppearances Class

BarManagerAppearances Members

DevExpress.XtraBars Namespace