0 out of 1 rated this helpful - Rate this topic

SystemColors Class

Contains system colors, system brushes, and system resource keys that correspond to system display elements.

System.Object
  System.Windows.SystemColors

Namespace:  System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
public static class SystemColors
You cannot declare this managed class in XAML, but you can use its static properties to assign values in XAML.

The SystemColors type exposes the following members.

  Name Description
Public property Static member ActiveBorderBrush Gets a SolidColorBrush that is the color of the active window's border.
Public property Static member ActiveBorderBrushKey Gets the ResourceKey for the SolidColorBrush used to paint the active window's border.
Public property Static member ActiveBorderColor Gets a Color structure that is the color of the active window's border.
Public property Static member ActiveBorderColorKey Gets the ResourceKey for the Color of the active window's border.
Public property Static member ActiveCaptionBrush Gets a SolidColorBrush that is the color of the background of the active window's title bar.
Public property Static member ActiveCaptionBrushKey Gets the ResourceKey for the SolidColorBrush used to paint the background of the active window's title bar.
Public property Static member ActiveCaptionColor Gets a Color structure that is the background color of the active window's title bar.
Public property Static member ActiveCaptionColorKey Gets the ResourceKey for the background Color of the active window's title bar.
Public property Static member ActiveCaptionTextBrush Gets a SolidColorBrush that is the color of the text in the active window's title bar.
Public property Static member ActiveCaptionTextBrushKey Gets the ResourceKey for the SolidColorBrush that paints the text in the active window's title bar.
Public property Static member ActiveCaptionTextColor Gets a Color structure that is the color of the text in the active window's title bar.
Public property Static member ActiveCaptionTextColorKey Gets the ResourceKey for the Color of the text in the active window's title bar.
Public property Static member AppWorkspaceBrush Gets a SolidColorBrush that is the color of the application workspace.
Public property Static member AppWorkspaceBrushKey Gets the ResourceKey for the SolidColorBrush that paints the application workspace.
Public property Static member AppWorkspaceColor Gets a Color structure that is the color of the application workspace.
Public property Static member AppWorkspaceColorKey Gets the ResourceKey for the Color of the application workspace.
Public property Static member ControlBrush Gets a SolidColorBrush that is the face color of a three-dimensional display element.
Public property Static member ControlBrushKey Gets the ResourceKey for the SolidColorBrush that paints the face of a three-dimensional display element.
Public property Static member ControlColor Gets a Color structure that is the face color of a three-dimensional display element.
Public property Static member ControlColorKey Gets the ResourceKey for the face Color of a three-dimensional display element.
Public property Static member ControlDarkBrush Gets a SolidColorBrush that is the shadow color of a three-dimensional display element.
Public property Static member ControlDarkBrushKey Gets the ResourceKey for the SolidColorBrush that paints the shadow of a three-dimensional display element.
Public property Static member ControlDarkColor Gets a Color structure that is the shadow color of a three-dimensional display element.
Public property Static member ControlDarkColorKey Gets the ResourceKey for the shadow Color of a three-dimensional display element.
Public property Static member ControlDarkDarkBrush Gets a SolidColorBrush that is the dark shadow color of a three-dimensional display element.
Public property Static member ControlDarkDarkBrushKey Gets the ResourceKey for the SolidColorBrush that paints the dark shadow of a three-dimensional display element.
Public property Static member ControlDarkDarkColor Gets a Color structure that is the dark shadow color of a three-dimensional display element.
Public property Static member ControlDarkDarkColorKey Gets the ResourceKey for the dark shadow Color of the highlight color of a three-dimensional display element.
Public property Static member ControlLightBrush Gets a SolidColorBrush that is the light color of a three-dimensional display element.
Public property Static member ControlLightBrushKey Gets the ResourceKey for the SolidColorBrush that paints the light area of a three-dimensional display element.
Public property Static member ControlLightColor Gets a Color structure that is the light color of a three-dimensional display element.
Public property Static member ControlLightColorKey Gets the ResourceKey for the highlight Color of a three-dimensional display element.
Public property Static member ControlLightLightBrush Gets a SolidColorBrush that is the highlight color of a three-dimensional display element.
Public property Static member ControlLightLightBrushKey Gets the ResourceKey for the SolidColorBrush that paints the highlight of a three-dimensional display element.
Public property Static member ControlLightLightColor Gets a Color structure that is the highlight color of a three-dimensional display element.
Public property Static member ControlLightLightColorKey Gets the ResourceKey for the highlight Color of a three-dimensional display element.
Public property Static member ControlTextBrush Gets a SolidColorBrush that is the color of text in a three-dimensional display element.
Public property Static member ControlTextBrushKey Gets the ResourceKey for the SolidColorBrush that paints text in a three-dimensional display element.
Public property Static member ControlTextColor Gets a Color structure that is the color of text in a three-dimensional display element.
Public property Static member ControlTextColorKey Gets the ResourceKey for the Color of text in a three-dimensional display element.
Public property Static member DesktopBrush Gets a SolidColorBrush that is the color of the desktop.
Public property Static member DesktopBrushKey Gets the ResourceKey for the SolidColorBrush that paints the desktop.
Public property Static member DesktopColor Gets a Color structure that is the color of the desktop.
Public property Static member DesktopColorKey Gets the ResourceKey for the Color of the desktop.
Public property Static member GradientActiveCaptionBrush Gets a SolidColorBrush that is the right side color in the gradient of an active window's title bar.
Public property Static member GradientActiveCaptionBrushKey Gets the ResourceKey for the SolidColorBrush that is the color of the right side of the gradient of an active window's title bar.
Public property Static member GradientActiveCaptionColor Gets a Color structure that is the right side color in the gradient of an active window's title bar.
Public property Static member GradientActiveCaptionColorKey Gets the ResourceKey for the right-side Color in the gradient of an active window's title bar.
Public property Static member GradientInactiveCaptionBrush Gets a SolidColorBrush that is the right side color in the gradient of an inactive window's title bar.
Public property Static member GradientInactiveCaptionBrushKey Gets the ResourceKey for the SolidColorBrush that is the color of the right side of the gradient of an inactive window's title bar.
Public property Static member GradientInactiveCaptionColor Gets a Color structure that is the right side color in the gradient of an inactive window's title bar.
Public property Static member GradientInactiveCaptionColorKey Gets the ResourceKey for the right-side Color in the gradient of an inactive window's title bar.
Public property Static member GrayTextBrush Gets a SolidColorBrush that is the color of disabled text.
Public property Static member GrayTextBrushKey Gets the ResourceKey for the SolidColorBrush that paints disabled text.
Public property Static member GrayTextColor Gets a Color structure that is the color of disabled text.
Public property Static member GrayTextColorKey Gets the ResourceKey for the Color of disabled text.
Public property Static member HighlightBrush Gets a SolidColorBrush that paints the background of selected items.
Public property Static member HighlightBrushKey Gets the ResourceKey for the SolidColorBrush that paints the background of selected items.
Public property Static member HighlightColor Gets a Color structure that is the background color of selected items.
Public property Static member HighlightColorKey Gets the ResourceKey for the background Color of selected items.
Public property Static member HighlightTextBrush Gets a SolidColorBrush that is the color of the text of selected items.
Public property Static member HighlightTextBrushKey Gets the ResourceKey for the SolidColorBrush that paints the text of selected items.
Public property Static member HighlightTextColor Gets a Color structure that is the color of the text of selected items.
Public property Static member HighlightTextColorKey Gets the ResourceKey for the Color of a selected item's text.
Public property Static member HotTrackBrush Gets a SolidColorBrush that is the color used to designate a hot-tracked item.
Public property Static member HotTrackBrushKey Gets the ResourceKey for the SolidColorBrush that paints hot-tracked items.
Public property Static member HotTrackColor Gets a Color structure that is the color used to designate a hot-tracked item.
Public property Static member HotTrackColorKey Gets the ResourceKey for the Color that designates a hot-tracked item.
Public property Static member InactiveBorderBrush Gets a SolidColorBrush that is the color of an inactive window's border.
Public property Static member InactiveBorderBrushKey Gets the ResourceKey for the SolidColorBrush that paints the border of an inactive window.
Public property Static member InactiveBorderColor Gets a Color structure that is the color of an inactive window's border.
Public property Static member InactiveBorderColorKey Gets the ResourceKey for the Color of an inactive window's border.
Public property Static member InactiveCaptionBrush Gets a SolidColorBrush that is the background color of an inactive window's title bar.
Public property Static member InactiveCaptionBrushKey Gets the ResourceKey for the SolidColorBrush that paints the background of an inactive window's title bar.
Public property Static member InactiveCaptionColor Gets a Color structure that is the background color of an inactive window's title bar.
Public property Static member InactiveCaptionColorKey Gets the ResourceKey for the background Color of an inactive window's title bar.
Public property Static member InactiveCaptionTextBrush Gets a SolidColorBrush that is the color of the text of an inactive window's title bar.
Public property Static member InactiveCaptionTextBrushKey Gets the ResourceKey for the SolidColorBrush that paints the text of an inactive window's title bar.
Public property Static member InactiveCaptionTextColor Gets a Color structure that is the color of the text of an inactive window's title bar.
Public property Static member InactiveCaptionTextColorKey Gets the ResourceKey for the Color of the text of an inactive window's title bar.
Public property Static member InfoBrush Gets a SolidColorBrush that is the background color for the ToolTip control.
Public property Static member InfoBrushKey Gets the ResourceKey for the SolidColorBrush that paints the background of the ToolTip control.
Public property Static member InfoColor Gets a Color structure that is the background color for the ToolTip control.
Public property Static member InfoColorKey Gets the ResourceKey for the background Color of the ToolTip control.
Public property Static member InfoTextBrush Gets a SolidColorBrush that is the text color for the ToolTip control.
Public property Static member InfoTextBrushKey Gets the ResourceKey for the SolidColorBrush that paints the text in a ToolTip control.
Public property Static member InfoTextColor Gets a Color structure that is the text color for the ToolTip control.
Public property Static member InfoTextColorKey Gets the ResourceKey for the Color of the text in a ToolTip control.
Public property Static member MenuBarBrush Gets a SolidColorBrush that is the background color for a menu bar.
Public property Static member MenuBarBrushKey Gets the ResourceKey for the SolidColorBrush that paints the background of a menu bar.
Public property Static member MenuBarColor Gets a Color structure that is the background color for a menu bar.
Public property Static member MenuBarColorKey Gets the ResourceKey for the background Color of a menu bar.
Public property Static member MenuBrush Gets a SolidColorBrush that is the color of a menu's background.
Public property Static member MenuBrushKey Gets the ResourceKey for the SolidColorBrush that paints the background of a menu.
Public property Static member MenuColor Gets a Color structure that is the color of a menu's background.
Public property Static member MenuColorKey Gets the ResourceKey for the background Color of a menu.
Public property Static member MenuHighlightBrush Gets a SolidColorBrush that is the color used to highlight a menu item.
Public property Static member MenuHighlightBrushKey Gets the ResourceKey for the SolidColorBrush that paints a highlighted menu item.
Public property Static member MenuHighlightColor Gets a Color structure that is the color used to highlight a menu item.
Public property Static member MenuHighlightColorKey Gets the ResourceKey for the background Color of a highlighted menu item.
Public property Static member MenuTextBrush Gets a SolidColorBrush that is the color of a menu's text.
Public property Static member MenuTextBrushKey Gets the ResourceKey for the SolidColorBrush that paints a menu's text.
Public property Static member MenuTextColor Gets a Color structure that is the color of a menu's text.
Public property Static member MenuTextColorKey Gets the ResourceKey for the Color of a menu's text.
Public property Static member ScrollBarBrush Gets a SolidColorBrush that is the background color of a scroll bar.
Public property Static member ScrollBarBrushKey Gets the ResourceKey for the SolidColorBrush that paints the background of a scroll bar.
Public property Static member ScrollBarColor Gets a Color structure that is the background color of a scroll bar.
Public property Static member ScrollBarColorKey Gets the ResourceKey for the background Color of a scroll bar.
Public property Static member WindowBrush Gets a SolidColorBrush that is the background color in the client area of a window.
Public property Static member WindowBrushKey Gets the ResourceKey for the SolidColorBrush that paints the background of a window's client area.
Public property Static member WindowColor Gets a Color structure that is the background color in the client area of a window.
Public property Static member WindowColorKey Gets the ResourceKey for the background Color of a window's client area.
Public property Static member WindowFrameBrush Gets a SolidColorBrush that is the color of a window frame.
Public property Static member WindowFrameBrushKey Gets the ResourceKey for the SolidColorBrush that paints a window frame.
Public property Static member WindowFrameColor Gets a Color structure that is the color of a window frame.
Public property Static member WindowFrameColorKey Gets the ResourceKey for the Color of a window frame.
Public property Static member WindowTextBrush Gets a SolidColorBrush that is the color of the text in the client area of a window.
Public property Static member WindowTextBrushKey Gets the ResourceKey for the SolidColorBrush that paints the text in the client area of a window.
Public property Static member WindowTextColor Gets a Color structure that is the color of the text in the client area of a window.
Public property Static member WindowTextColorKey Gets the ResourceKey for the Color of text in a window's client area.
Top

The SystemColors class provides access to system brushes and colors, such as ControlBrush, ControlBrushKey, and DesktopBrush. A system brush is a SolidColorBrush object that paints an area with the specified system color. A system brush always produces a solid fill; it can't be used to create a gradient.

You can use system brushes as either a static or a dynamic resource. Use a dynamic resource if you want the brush to update automatically if the user changes the system brush as the application is running; otherwise, use a static resource. The SystemColors class contains a variety of static properties that follow a strict naming convention:

  • <SystemColor>Brush

    Gets a static reference to a SolidColorBrush of the specified system color.

  • <SystemColor>BrushKey

    Gets a dynamic reference to a SolidColorBrush of the specified system color.

  • <SystemColor>Color

    Gets a static reference to a Color structure of the specified system color.

  • <SystemColor>ColorKey

    Gets a dynamic reference to the Color structure of the specified system color.

A system color is a Color structure that can be used to configure a brush. For example, you can create a gradient using system colors by setting the Color properties of a LinearGradientBrush object's gradient stops with system colors. For an example, see How to: Use System Colors in a Gradient.

The following example uses a dynamic system brush reference to set the Background of a button.


<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  WindowTitle="SystemColors Example" Background="White">  
  <StackPanel Margin="20">

    <!-- Uses a dynamic resource to set the 
         background of a button. 
         If the desktop brush changes while this application
         is running, this button will be updated. -->
    <Button 
      Background="{DynamicResource {x:Static SystemColors.DesktopBrushKey}}" 
      Content="Hello, World!" />

  </StackPanel>
</Page>


The next example uses a static system brush reference to set the Background of a button.


<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  WindowTitle="SystemColors Example" Background="White">  
  <StackPanel Margin="20">

    <!-- Uses a static brush to set the
         background of a button. 
         If the desktop brush changes while this application
         is running, this button will not be updated until
         the page is loaded again. -->
    <Button 
      Background="{x:Static SystemColors.DesktopBrush}" 
      Content="Hello, World!"  /> 

  </StackPanel>
</Page>


For an example showing how to use a system color in a gradient, see How to: Use System Colors in a Gradient.

More Code

How to: Use System Colors in a Gradient To use a system color in a gradient, you use the <SystemColor>Color and <SystemColor>ColorKey static properties of the SystemColors class to obtain a reference to the color, where <SystemColor> is the name of the desired system color. Use the <SystemColor>ColorKey properties when you want to create a dynamic reference that updates automatically as the system theme changes. Otherwise, use the <SystemColor>Color properties.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ