Export (0) Print
Expand All
1 out of 3 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.

  NameDescription
Public propertyStatic memberActiveBorderBrushGets a SolidColorBrush that is the color of the active window's border.
Public propertyStatic memberActiveBorderBrushKeyGets the ResourceKey for the SolidColorBrush used to paint the active window's border.
Public propertyStatic memberActiveBorderColorGets a Color structure that is the color of the active window's border.
Public propertyStatic memberActiveBorderColorKeyGets the ResourceKey for the Color of the active window's border.
Public propertyStatic memberActiveCaptionBrushGets a SolidColorBrush that is the color of the background of the active window's title bar.
Public propertyStatic memberActiveCaptionBrushKeyGets the ResourceKey for the SolidColorBrush used to paint the background of the active window's title bar.
Public propertyStatic memberActiveCaptionColorGets a Color structure that is the background color of the active window's title bar.
Public propertyStatic memberActiveCaptionColorKeyGets the ResourceKey for the background Color of the active window's title bar.
Public propertyStatic memberActiveCaptionTextBrushGets a SolidColorBrush that is the color of the text in the active window's title bar.
Public propertyStatic memberActiveCaptionTextBrushKeyGets the ResourceKey for the SolidColorBrush that paints the text in the active window's title bar.
Public propertyStatic memberActiveCaptionTextColorGets a Color structure that is the color of the text in the active window's title bar.
Public propertyStatic memberActiveCaptionTextColorKeyGets the ResourceKey for the Color of the text in the active window's title bar.
Public propertyStatic memberAppWorkspaceBrushGets a SolidColorBrush that is the color of the application workspace.
Public propertyStatic memberAppWorkspaceBrushKeyGets the ResourceKey for the SolidColorBrush that paints the application workspace.
Public propertyStatic memberAppWorkspaceColorGets a Color structure that is the color of the application workspace.
Public propertyStatic memberAppWorkspaceColorKeyGets the ResourceKey for the Color of the application workspace.
Public propertyStatic memberControlBrushGets a SolidColorBrush that is the face color of a three-dimensional display element.
Public propertyStatic memberControlBrushKeyGets the ResourceKey for the SolidColorBrush that paints the face of a three-dimensional display element.
Public propertyStatic memberControlColorGets a Color structure that is the face color of a three-dimensional display element.
Public propertyStatic memberControlColorKeyGets the ResourceKey for the face Color of a three-dimensional display element.
Public propertyStatic memberControlDarkBrushGets a SolidColorBrush that is the shadow color of a three-dimensional display element.
Public propertyStatic memberControlDarkBrushKeyGets the ResourceKey for the SolidColorBrush that paints the shadow of a three-dimensional display element.
Public propertyStatic memberControlDarkColorGets a Color structure that is the shadow color of a three-dimensional display element.
Public propertyStatic memberControlDarkColorKeyGets the ResourceKey for the shadow Color of a three-dimensional display element.
Public propertyStatic memberControlDarkDarkBrushGets a SolidColorBrush that is the dark shadow color of a three-dimensional display element.
Public propertyStatic memberControlDarkDarkBrushKeyGets the ResourceKey for the SolidColorBrush that paints the dark shadow of a three-dimensional display element.
Public propertyStatic memberControlDarkDarkColorGets a Color structure that is the dark shadow color of a three-dimensional display element.
Public propertyStatic memberControlDarkDarkColorKeyGets the ResourceKey for the dark shadow Color of the highlight color of a three-dimensional display element.
Public propertyStatic memberControlLightBrushGets a SolidColorBrush that is the light color of a three-dimensional display element.
Public propertyStatic memberControlLightBrushKeyGets the ResourceKey for the SolidColorBrush that paints the light area of a three-dimensional display element.
Public propertyStatic memberControlLightColorGets a Color structure that is the light color of a three-dimensional display element.
Public propertyStatic memberControlLightColorKeyGets the ResourceKey for the highlight Color of a three-dimensional display element.
Public propertyStatic memberControlLightLightBrushGets a SolidColorBrush that is the highlight color of a three-dimensional display element.
Public propertyStatic memberControlLightLightBrushKeyGets the ResourceKey for the SolidColorBrush that paints the highlight of a three-dimensional display element.
Public propertyStatic memberControlLightLightColorGets a Color structure that is the highlight color of a three-dimensional display element.
Public propertyStatic memberControlLightLightColorKeyGets the ResourceKey for the highlight Color of a three-dimensional display element.
Public propertyStatic memberControlTextBrushGets a SolidColorBrush that is the color of text in a three-dimensional display element.
Public propertyStatic memberControlTextBrushKeyGets the ResourceKey for the SolidColorBrush that paints text in a three-dimensional display element.
Public propertyStatic memberControlTextColorGets a Color structure that is the color of text in a three-dimensional display element.
Public propertyStatic memberControlTextColorKeyGets the ResourceKey for the Color of text in a three-dimensional display element.
Public propertyStatic memberDesktopBrushGets a SolidColorBrush that is the color of the desktop.
Public propertyStatic memberDesktopBrushKeyGets the ResourceKey for the SolidColorBrush that paints the desktop.
Public propertyStatic memberDesktopColorGets a Color structure that is the color of the desktop.
Public propertyStatic memberDesktopColorKeyGets the ResourceKey for the Color of the desktop.
Public propertyStatic memberGradientActiveCaptionBrushGets a SolidColorBrush that is the right side color in the gradient of an active window's title bar.
Public propertyStatic memberGradientActiveCaptionBrushKeyGets the ResourceKey for the SolidColorBrush that is the color of the right side of the gradient of an active window's title bar.
Public propertyStatic memberGradientActiveCaptionColorGets a Color structure that is the right side color in the gradient of an active window's title bar.
Public propertyStatic memberGradientActiveCaptionColorKeyGets the ResourceKey for the right-side Color in the gradient of an active window's title bar.
Public propertyStatic memberGradientInactiveCaptionBrushGets a SolidColorBrush that is the right side color in the gradient of an inactive window's title bar.
Public propertyStatic memberGradientInactiveCaptionBrushKeyGets the ResourceKey for the SolidColorBrush that is the color of the right side of the gradient of an inactive window's title bar.
Public propertyStatic memberGradientInactiveCaptionColorGets a Color structure that is the right side color in the gradient of an inactive window's title bar.
Public propertyStatic memberGradientInactiveCaptionColorKeyGets the ResourceKey for the right-side Color in the gradient of an inactive window's title bar.
Public propertyStatic memberGrayTextBrushGets a SolidColorBrush that is the color of disabled text.
Public propertyStatic memberGrayTextBrushKeyGets the ResourceKey for the SolidColorBrush that paints disabled text.
Public propertyStatic memberGrayTextColorGets a Color structure that is the color of disabled text.
Public propertyStatic memberGrayTextColorKeyGets the ResourceKey for the Color of disabled text.
Public propertyStatic memberHighlightBrushGets a SolidColorBrush that paints the background of selected items.
Public propertyStatic memberHighlightBrushKeyGets the ResourceKey for the SolidColorBrush that paints the background of selected items.
Public propertyStatic memberHighlightColorGets a Color structure that is the background color of selected items.
Public propertyStatic memberHighlightColorKeyGets the ResourceKey for the background Color of selected items.
Public propertyStatic memberHighlightTextBrushGets a SolidColorBrush that is the color of the text of selected items.
Public propertyStatic memberHighlightTextBrushKeyGets the ResourceKey for the SolidColorBrush that paints the text of selected items.
Public propertyStatic memberHighlightTextColorGets a Color structure that is the color of the text of selected items.
Public propertyStatic memberHighlightTextColorKeyGets the ResourceKey for the Color of a selected item's text.
Public propertyStatic memberHotTrackBrushGets a SolidColorBrush that is the color used to designate a hot-tracked item.
Public propertyStatic memberHotTrackBrushKeyGets the ResourceKey for the SolidColorBrush that paints hot-tracked items.
Public propertyStatic memberHotTrackColorGets a Color structure that is the color used to designate a hot-tracked item.
Public propertyStatic memberHotTrackColorKeyGets the ResourceKey for the Color that designates a hot-tracked item.
Public propertyStatic memberInactiveBorderBrushGets a SolidColorBrush that is the color of an inactive window's border.
Public propertyStatic memberInactiveBorderBrushKeyGets the ResourceKey for the SolidColorBrush that paints the border of an inactive window.
Public propertyStatic memberInactiveBorderColorGets a Color structure that is the color of an inactive window's border.
Public propertyStatic memberInactiveBorderColorKeyGets the ResourceKey for the Color of an inactive window's border.
Public propertyStatic memberInactiveCaptionBrushGets a SolidColorBrush that is the background color of an inactive window's title bar.
Public propertyStatic memberInactiveCaptionBrushKeyGets the ResourceKey for the SolidColorBrush that paints the background of an inactive window's title bar.
Public propertyStatic memberInactiveCaptionColorGets a Color structure that is the background color of an inactive window's title bar.
Public propertyStatic memberInactiveCaptionColorKeyGets the ResourceKey for the background Color of an inactive window's title bar.
Public propertyStatic memberInactiveCaptionTextBrushGets a SolidColorBrush that is the color of the text of an inactive window's title bar.
Public propertyStatic memberInactiveCaptionTextBrushKeyGets the ResourceKey for the SolidColorBrush that paints the text of an inactive window's title bar.
Public propertyStatic memberInactiveCaptionTextColorGets a Color structure that is the color of the text of an inactive window's title bar.
Public propertyStatic memberInactiveCaptionTextColorKeyGets the ResourceKey for the Color of the text of an inactive window's title bar.
Public propertyStatic memberInfoBrushGets a SolidColorBrush that is the background color for the ToolTip control.
Public propertyStatic memberInfoBrushKeyGets the ResourceKey for the SolidColorBrush that paints the background of the ToolTip control.
Public propertyStatic memberInfoColorGets a Color structure that is the background color for the ToolTip control.
Public propertyStatic memberInfoColorKeyGets the ResourceKey for the background Color of the ToolTip control.
Public propertyStatic memberInfoTextBrushGets a SolidColorBrush that is the text color for the ToolTip control.
Public propertyStatic memberInfoTextBrushKeyGets the ResourceKey for the SolidColorBrush that paints the text in a ToolTip control.
Public propertyStatic memberInfoTextColorGets a Color structure that is the text color for the ToolTip control.
Public propertyStatic memberInfoTextColorKeyGets the ResourceKey for the Color of the text in a ToolTip control.
Public propertyStatic memberMenuBarBrushGets a SolidColorBrush that is the background color for a menu bar.
Public propertyStatic memberMenuBarBrushKeyGets the ResourceKey for the SolidColorBrush that paints the background of a menu bar.
Public propertyStatic memberMenuBarColorGets a Color structure that is the background color for a menu bar.
Public propertyStatic memberMenuBarColorKeyGets the ResourceKey for the background Color of a menu bar.
Public propertyStatic memberMenuBrushGets a SolidColorBrush that is the color of a menu's background.
Public propertyStatic memberMenuBrushKeyGets the ResourceKey for the SolidColorBrush that paints the background of a menu.
Public propertyStatic memberMenuColorGets a Color structure that is the color of a menu's background.
Public propertyStatic memberMenuColorKeyGets the ResourceKey for the background Color of a menu.
Public propertyStatic memberMenuHighlightBrushGets a SolidColorBrush that is the color used to highlight a menu item.
Public propertyStatic memberMenuHighlightBrushKeyGets the ResourceKey for the SolidColorBrush that paints a highlighted menu item.
Public propertyStatic memberMenuHighlightColorGets a Color structure that is the color used to highlight a menu item.
Public propertyStatic memberMenuHighlightColorKeyGets the ResourceKey for the background Color of a highlighted menu item.
Public propertyStatic memberMenuTextBrushGets a SolidColorBrush that is the color of a menu's text.
Public propertyStatic memberMenuTextBrushKeyGets the ResourceKey for the SolidColorBrush that paints a menu's text.
Public propertyStatic memberMenuTextColorGets a Color structure that is the color of a menu's text.
Public propertyStatic memberMenuTextColorKeyGets the ResourceKey for the Color of a menu's text.
Public propertyStatic memberScrollBarBrushGets a SolidColorBrush that is the background color of a scroll bar.
Public propertyStatic memberScrollBarBrushKeyGets the ResourceKey for the SolidColorBrush that paints the background of a scroll bar.
Public propertyStatic memberScrollBarColorGets a Color structure that is the background color of a scroll bar.
Public propertyStatic memberScrollBarColorKeyGets the ResourceKey for the background Color of a scroll bar.
Public propertyStatic memberWindowBrushGets a SolidColorBrush that is the background color in the client area of a window.
Public propertyStatic memberWindowBrushKeyGets the ResourceKey for the SolidColorBrush that paints the background of a window's client area.
Public propertyStatic memberWindowColorGets a Color structure that is the background color in the client area of a window.
Public propertyStatic memberWindowColorKeyGets the ResourceKey for the background Color of a window's client area.
Public propertyStatic memberWindowFrameBrushGets a SolidColorBrush that is the color of a window frame.
Public propertyStatic memberWindowFrameBrushKeyGets the ResourceKey for the SolidColorBrush that paints a window frame.
Public propertyStatic memberWindowFrameColorGets a Color structure that is the color of a window frame.
Public propertyStatic memberWindowFrameColorKeyGets the ResourceKey for the Color of a window frame.
Public propertyStatic memberWindowTextBrushGets a SolidColorBrush that is the color of the text in the client area of a window.
Public propertyStatic memberWindowTextBrushKeyGets the ResourceKey for the SolidColorBrush that paints the text in the client area of a window.
Public propertyStatic memberWindowTextColorGets a Color structure that is the color of the text in the client area of a window.
Public propertyStatic memberWindowTextColorKeyGets 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 GradientTo 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.

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.