Back to Devexpress

BarItem.Foreground Property

wpf-devexpress-dot-xpf-dot-bars-dot-baritem-2a678d01.md

latest3.7 KB
Original Source

BarItem.Foreground Property

Gets or sets the brush used to paint the BarItem’s foreground. This is a dependency property.

Namespace : DevExpress.Xpf.Bars

Assembly : DevExpress.Xpf.Core.v25.2.dll

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public Brush Foreground { get; set; }
vb
Public Property Foreground As Brush

Property Value

TypeDescription
Brush

A Brush object used to paint the BarItem’s foreground.

|

Remarks

The following code sample specifies the ToolBarControl‘s Background, and BarButtonItems‘s Background, Foreground , BorderBrush, and BorderThickness properties:

xaml
<Window ...
  xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"> 
    <dxb:ToolBarControl VerticalAlignment="Top" Background="Gainsboro">
      <dxb:BarButtonItem Content="Cut" Background="LightCoral"/>
      <dxb:BarButtonItem Content="Copy" Foreground="DarkGray"/>
      <dxb:BarButtonItem Content="Paste" BorderBrush="Aqua" BorderThickness="2"/> 
    </dxb:ToolBarControl>
</Window>

Note

The property is supported in the following DevExpress themes:

Theme FamilyThemes
Windows 11Dark, Light
Windows 10Dark, Light
Office 2019Black, Colorful, Dark Gray, White, HighContrast
Visual Studio 2019Blue, Dark, Light
Office 2016 SEBlack, Colorful, Dark Gray, White
Visual Studio 2017Blue, Dark, Light

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Foreground property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

mvvm-application-with-wpf-bars/CS/Bars_in_MVVM_Application/MainWindow.xaml#L51

xml
IsEnabled="{DXBinding 'SelectedIssue != null'}">
<dxb:BarCheckItem Content="Low" GroupIndex="0" Background="Green" Foreground="White"
                  Command="{DXCommand Execute='SelectedIssue.Priority = $local:Priority.Low'}"

See Also

BarItem Class

BarItem Members

DevExpress.Xpf.Bars Namespace