Export (0) Print
Expand All

Brushes Class

Implements a set of predefined SolidColorBrush objects.

System.Object
  System.Windows.Media.Brushes

Namespace:  System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public sealed class Brushes
You cannot declare this managed class in XAML, but you can use its static properties to assign values in XAML.

The Brushes type exposes the following members.

  NameDescription
Public propertyStatic memberAliceBlueGets the solid fill color that has a hexadecimal value of #FFF0F8FF.
Public propertyStatic memberAntiqueWhiteGets the solid fill color that has a hexadecimal value of #FFFAEBD7.
Public propertyStatic memberAquaGets the solid fill color that has a hexadecimal value of #FF00FFFF.
Public propertyStatic memberAquamarineGets the solid fill color that has a hexadecimal value of #FF7FFFD4.
Public propertyStatic memberAzureGets the solid fill color that has a hexadecimal value of #FFF0FFFF.
Public propertyStatic memberBeigeGets the solid fill color that has a hexadecimal value of #FFF5F5DC.
Public propertyStatic memberBisqueGets the solid fill color that has a hexadecimal value of #FFFFE4C4.
Public propertyStatic memberBlackGets the solid fill color that has a hexadecimal value of #FF000000.
Public propertyStatic memberBlanchedAlmond Gets the solid fill color that has a hexadecimal value of #FFFFEBCD.
Public propertyStatic memberBlueGets the solid fill color that has a hexadecimal value of #FF0000FF.
Public propertyStatic memberBlueVioletGets the solid fill color that has a hexadecimal value of #FF8A2BE2.
Public propertyStatic memberBrownGets the solid fill color that has a hexadecimal value of #FFA52A2A.
Public propertyStatic memberBurlyWoodGets the solid fill color that has a hexadecimal value of #FFDEB887.
Public propertyStatic memberCadetBlueGets the solid fill color that has a hexadecimal value of #FF5F9EA0.
Public propertyStatic memberChartreuseGets the solid fill color that has a hexadecimal value of #FF7FFF00.
Public propertyStatic memberChocolateGets the solid fill color that has a hexadecimal value of #FFD2691E.
Public propertyStatic memberCoralGets the solid fill color that has a hexadecimal value of #FFFF7F50.
Public propertyStatic memberCornflowerBlueGets the solid fill color that has a hexadecimal value of #FF6495ED.
Public propertyStatic memberCornsilkGets the solid fill color that has a hexadecimal value of #FFFFF8DC.
Public propertyStatic memberCrimsonGets the solid fill color that has a hexadecimal value of #FFDC143C.
Public propertyStatic memberCyanGets the solid fill color that has a hexadecimal value of #FF00FFFF.
Public propertyStatic memberDarkBlueGets the solid fill color that has a hexadecimal value of #FF00008B.
Public propertyStatic memberDarkCyanGets the solid fill color that has a hexadecimal value of #FF008B8B.
Public propertyStatic memberDarkGoldenrodGets the solid fill color that has a hexadecimal value of #FFB8860B.
Public propertyStatic memberDarkGrayGets the solid fill color that has a hexadecimal value of #FFA9A9A9.
Public propertyStatic memberDarkGreenGets the solid fill color that has a hexadecimal value of #FF006400.
Public propertyStatic memberDarkKhakiGets the solid fill color that has a hexadecimal value of #FFBDB76B.
Public propertyStatic memberDarkMagentaGets the solid fill color that has a hexadecimal value of #FF8B008B.
Public propertyStatic memberDarkOliveGreenGets the solid fill color that has a hexadecimal value of #FF556B2F.
Public propertyStatic memberDarkOrangeGets the solid fill color that has a hexadecimal value of #FFFF8C00.
Public propertyStatic memberDarkOrchidGets the solid fill color that has a hexadecimal value of #FF9932CC.
Public propertyStatic memberDarkRedGets the solid fill color that has a hexadecimal value of #FF8B0000.
Public propertyStatic memberDarkSalmonGets the solid fill color that has a hexadecimal value of #FFE9967A.
Public propertyStatic memberDarkSeaGreenGets the solid fill color that has a hexadecimal value of #FF8FBC8F.
Public propertyStatic memberDarkSlateBlueGets the solid fill color that has a hexadecimal value of #FF483D8B.
Public propertyStatic memberDarkSlateGrayGets the solid fill color that has a hexadecimal value of #FF2F4F4F.
Public propertyStatic memberDarkTurquoiseGets the solid fill color that has a hexadecimal value of #FF00CED1.
Public propertyStatic memberDarkVioletGets the solid fill color that has a hexadecimal value of #FF9400D3.
Public propertyStatic memberDeepPinkGets the solid fill color that has a hexadecimal value of #FFFF1493.
Public propertyStatic memberDeepSkyBlueGets the solid fill color that has a hexadecimal value of #FF00BFFF.
Public propertyStatic memberDimGrayGets the solid fill color that has a hexadecimal value of #FF696969.
Public propertyStatic memberDodgerBlueGets the solid fill color that has a hexadecimal value of #FF1E90FF.
Public propertyStatic memberFirebrickGets the solid fill color that has a hexadecimal value of #FFB22222.
Public propertyStatic memberFloralWhiteGets the solid fill color that has a hexadecimal value of #FFFFFAF0.
Public propertyStatic memberForestGreenGets the solid fill color that has a hexadecimal value of #FF228B22.
Public propertyStatic memberFuchsiaGets the solid fill color that has a hexadecimal value of #FFFF00FF.
Public propertyStatic memberGainsboroGets the solid fill color that has a hexadecimal value of #FFDCDCDC.
Public propertyStatic memberGhostWhiteGets the solid fill color that has a hexadecimal value of #FFF8F8FF.
Public propertyStatic memberGoldGets the solid fill color that has a hexadecimal value of #FFFFD700.
Public propertyStatic memberGoldenrodGets the solid fill color that has a hexadecimal value of #FFDAA520.
Public propertyStatic memberGrayGets the solid fill color that has a hexadecimal value of #FF808080.
Public propertyStatic memberGreenGets the solid fill color that has a hexadecimal value of #FF008000.
Public propertyStatic memberGreenYellowGets the solid fill color that has a hexadecimal value of #FFADFF2F.
Public propertyStatic memberHoneydewGets the solid fill color that has a hexadecimal value of #FFF0FFF0.
Public propertyStatic memberHotPinkGets the solid fill color that has a hexadecimal value of #FFFF69B4.
Public propertyStatic memberIndianRedGets the solid fill color that has a hexadecimal value of #FFCD5C5C.
Public propertyStatic memberIndigoGets the solid fill color that has a hexadecimal value of #FF4B0082.
Public propertyStatic memberIvoryGets the solid fill color that has a hexadecimal value of #FFFFFFF0.
Public propertyStatic memberKhakiGets the solid fill color that has a hexadecimal value of #FFF0E68C.
Public propertyStatic memberLavenderGets the solid fill color that has a hexadecimal value of #FFE6E6FA.
Public propertyStatic memberLavenderBlushGets the solid fill color that has a hexadecimal value of #FFFFF0F5.
Public propertyStatic memberLawnGreenGets the solid fill color that has a hexadecimal value of #FF7CFC00.
Public propertyStatic memberLemonChiffonGets the solid fill color that has a hexadecimal value of #FFFFFACD.
Public propertyStatic memberLightBlueGets the solid fill color that has a hexadecimal value of #FFADD8E6.
Public propertyStatic memberLightCoralGets the solid fill color that has a hexadecimal value of #FFF08080.
Public propertyStatic memberLightCyanGets the solid fill color that has a hexadecimal value of #FFE0FFFF.
Public propertyStatic memberLightGoldenrodYellowGets the solid fill color that has a hexadecimal value of #FFFAFAD2.
Public propertyStatic memberLightGrayGets the solid fill color that has a hexadecimal value of #FFD3D3D3.
Public propertyStatic memberLightGreenGets the solid fill color that has a hexadecimal value of #FF90EE90.
Public propertyStatic memberLightPinkGets the solid fill color that has a hexadecimal value of #FFFFB6C1.
Public propertyStatic memberLightSalmonGets the solid fill color that has a hexadecimal value of #FFFFA07A.
Public propertyStatic memberLightSeaGreenGets the solid fill color that has a hexadecimal value of #FF20B2AA.
Public propertyStatic memberLightSkyBlueGets the solid fill color that has a hexadecimal value of #FF87CEFA.
Public propertyStatic memberLightSlateGrayGets the solid fill color that has a hexadecimal value of #FF778899.
Public propertyStatic memberLightSteelBlueGets the solid fill color that has a hexadecimal value of #FFB0C4DE.
Public propertyStatic memberLightYellowGets the solid fill color that has a hexadecimal value of #FFFFFFE0.
Public propertyStatic memberLimeGets the solid fill color that has a hexadecimal value of #FF00FF00.
Public propertyStatic memberLimeGreenGets the solid fill color that has a hexadecimal value of #FF32CD32.
Public propertyStatic memberLinenGets the solid fill color that has a hexadecimal value of #FFFAF0E6.
Public propertyStatic memberMagentaGets the solid fill color that has a hexadecimal value of #FFFF00FF.
Public propertyStatic memberMaroonGets the solid fill color that has a hexadecimal value of #FF800000.
Public propertyStatic memberMediumAquamarineGets the solid fill color that has a hexadecimal value of #FF66CDAA.
Public propertyStatic memberMediumBlueGets the solid fill color that has a hexadecimal value of #FF0000CD.
Public propertyStatic memberMediumOrchidGets the solid fill color that has a hexadecimal value of #FFBA55D3.
Public propertyStatic memberMediumPurpleGets the solid fill color that has a hexadecimal value of #FF9370DB.
Public propertyStatic memberMediumSeaGreenGets the solid fill color that has a hexadecimal value of #FF3CB371.
Public propertyStatic memberMediumSlateBlueGets the solid fill color that has a hexadecimal value of #FF7B68EE.
Public propertyStatic memberMediumSpringGreenGets the solid fill color that has a hexadecimal value of #FF00FA9A.
Public propertyStatic memberMediumTurquoiseGets the solid fill color that has a hexadecimal value of #FF48D1CC.
Public propertyStatic memberMediumVioletRedGets the solid fill color that has a hexadecimal value of #FFC71585.
Public propertyStatic memberMidnightBlueGets the solid fill color that has a hexadecimal value of #FF191970.
Public propertyStatic memberMintCreamGets the solid fill color that has a hexadecimal value of #FFF5FFFA.
Public propertyStatic memberMistyRoseGets the solid fill color that has a hexadecimal value of #FFFFE4E1.
Public propertyStatic memberMoccasinGets the solid fill color that has a hexadecimal value of #FFFFE4B5.
Public propertyStatic memberNavajoWhiteGets the solid fill color that has a hexadecimal value of #FFFFDEAD.
Public propertyStatic memberNavyGets the solid fill color that has a hexadecimal value of #FF000080.
Public propertyStatic memberOldLaceGets the solid fill color that has a hexadecimal value of #FFFDF5E6.
Public propertyStatic memberOliveGets the solid fill color that has a hexadecimal value of #FF808000.
Public propertyStatic memberOliveDrabGets the solid fill color that has a hexadecimal value of #FF6B8E23.
Public propertyStatic memberOrangeGets the solid fill color that has a hexadecimal value of #FFFFA500.
Public propertyStatic memberOrangeRedGets the solid fill color that has a hexadecimal value of #FFFF4500.
Public propertyStatic memberOrchidGets the solid fill color that has a hexadecimal value of #FFDA70D6.
Public propertyStatic memberPaleGoldenrodGets the solid fill color that has a hexadecimal value of #FFEEE8AA.
Public propertyStatic memberPaleGreenGets the solid fill color that has a hexadecimal value of #FF98FB98.
Public propertyStatic memberPaleTurquoiseGets the solid fill color that has a hexadecimal value of #FFAFEEEE.
Public propertyStatic memberPaleVioletRedGets the solid fill color that has a hexadecimal value of #FFDB7093.
Public propertyStatic memberPapayaWhipGets the solid fill color that has a hexadecimal value of #FFFFEFD5.
Public propertyStatic memberPeachPuffGets the solid fill color that has a hexadecimal value of #FFFFDAB9.
Public propertyStatic memberPeruGets the solid fill color that has a hexadecimal value of #FFCD853F.
Public propertyStatic memberPinkGets the solid fill color that has a hexadecimal value of #FFFFC0CB.
Public propertyStatic memberPlumGets the solid fill color that has a hexadecimal value of #FFDDA0DD.
Public propertyStatic memberPowderBlueGets the solid fill color that has a hexadecimal value of #FFB0E0E6.
Public propertyStatic memberPurpleGets the solid fill color that has a hexadecimal value of #FF800080.
Public propertyStatic memberRedGets the solid fill color that has a hexadecimal value of #FFFF0000.
Public propertyStatic memberRosyBrownGets the solid fill color that has a hexadecimal value of #FFBC8F8F.
Public propertyStatic memberRoyalBlueGets the solid fill color that has a hexadecimal value of #FF4169E1.
Public propertyStatic memberSaddleBrownGets the solid fill color that has a hexadecimal value of #FF8B4513.
Public propertyStatic memberSalmonGets the solid fill color that has a hexadecimal value of #FFFA8072.
Public propertyStatic memberSandyBrownGets the solid fill color that has a hexadecimal value of #FFF4A460.
Public propertyStatic memberSeaGreenGets the solid fill color that has a hexadecimal value of #FF2E8B57.
Public propertyStatic memberSeaShellGets the solid fill color that has a hexadecimal value of #FFFFF5EE.
Public propertyStatic memberSiennaGets the solid fill color that has a hexadecimal value of #FFA0522D.
Public propertyStatic memberSilverGets the solid fill color that has a hexadecimal value of #FFC0C0C0.
Public propertyStatic memberSkyBlueGets the solid fill color that has a hexadecimal value of #FF87CEEB.
Public propertyStatic memberSlateBlueGets the solid fill color that has a hexadecimal value of #FF6A5ACD.
Public propertyStatic memberSlateGrayGets the solid fill color that has a hexadecimal value of #FF708090.
Public propertyStatic memberSnowGets the solid fill color that has a hexadecimal value of #FFFFFAFA.
Public propertyStatic memberSpringGreenGets the solid fill color that has a hexadecimal value of #FF00FF7F.
Public propertyStatic memberSteelBlueGets the solid fill color that has a hexadecimal value of #FF4682B4.
Public propertyStatic memberTanGets the solid fill color that has a hexadecimal value of #FFD2B48C.
Public propertyStatic memberTealGets the solid fill color that has a hexadecimal value of #FF008080.
Public propertyStatic memberThistleGets the solid fill color that has a hexadecimal value of #FFD8BFD8.
Public propertyStatic memberTomatoGets the solid fill color that has a hexadecimal value of #FFFF6347.
Public propertyStatic memberTransparentGets the solid fill color that has a hexadecimal value of #00FFFFFF.
Public propertyStatic memberTurquoiseGets the solid fill color that has a hexadecimal value of #FF40E0D0.
Public propertyStatic memberVioletGets the solid fill color that has a hexadecimal value of #FFEE82EE.
Public propertyStatic memberWheatGets the solid fill color that has a hexadecimal value of #FFF5DEB3.
Public propertyStatic memberWhiteGets the solid fill color that has a hexadecimal value of #FFFFFFFF.
Public propertyStatic memberWhiteSmokeGets the solid fill color that has a hexadecimal value of #FFF5F5F5.
Public propertyStatic memberYellowGets the solid fill color that has a hexadecimal value of #FFFFFF00.
Public propertyStatic memberYellowGreenGets the solid fill color that has a hexadecimal value of #FF9ACD32.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

Color names in Windows Presentation Foundation (WPF) match the color names in Microsoft .NET Framework, Windows Forms, and Microsoft Internet Explorer. These colors and their names are based on the UNIX X11 color values.

The following image shows the color of each predefined brush, its name, and its hexadecimal value.

Color table including a color swatch, the color name, and the hexadecimal value

Predefined colors

See the Brush class for a variety of other, more complex, ways that you can paint an area. For example, try using gradients (LinearGradientBrush, RadialGradientBrush) or images (ImageBrush).

To paint an area with a solid color, you can use a predefined system brush, such as Red or Blue, or you can create a new SolidColorBrush and describe its Color using alpha, red, green, and blue values. In XAML, you may also paint an area with a solid color by using hexidecimal notation.

The following examples uses each of these techniques to paint a Rectangle blue.

Using a Predefined Brush

In the following example uses the predefined brush Blue to paint a rectangle blue.

<Rectangle Width="50" Height="50" Fill="Blue" />
// Create a rectangle and paint it with 
// a predefined brush.
Rectangle myPredefinedBrushRectangle = new Rectangle();
myPredefinedBrushRectangle.Width = 50;
myPredefinedBrushRectangle.Height = 50;
myPredefinedBrushRectangle.Fill = Brushes.Blue;

Using Hexadecimal Notation

The next example uses 8-digit hexadecimal notation to paint a rectangle blue.

<!-- Note that the first two characters "FF" of the 8-digit
     value is the alpha which controls the transparency of 
     the color. Therefore, to make a completely transparent
     color (invisible), use "00" for those digits (e.g. #000000FF). -->
<Rectangle Width="50" Height="50" Fill="#FF0000FF" />

Using ARGB Values

The next example creates a SolidColorBrush and describes its Color using the ARGB values for the color blue.

<Rectangle Width="50" Height="50">
  <Rectangle.Fill>
    <SolidColorBrush>
     <SolidColorBrush.Color>

        <!-- Describes the brush's color using
             RGB values. Each value has a range of 0-255.  
             R is for red, G is for green, and B is for blue.
             A is for alpha which controls transparency of the
             color. Therefore, to make a completely transparent
             color (invisible), use a value of 0 for Alpha. -->
        <Color A="255" R="0" G="0" B="255" />
     </SolidColorBrush.Color>
    </SolidColorBrush>
  </Rectangle.Fill>
</Rectangle>
Rectangle myRgbRectangle = new Rectangle();
myRgbRectangle.Width = 50;
myRgbRectangle.Height = 50;
SolidColorBrush mySolidColorBrush = new SolidColorBrush();

// Describes the brush's color using RGB values.  
// Each value has a range of 0-255.
mySolidColorBrush.Color = Color.FromArgb(255, 0, 0, 255);
myRgbRectangle.Fill = mySolidColorBrush;           

For other ways of describing color, see the Color structure.

Related Topics

For more information about SolidColorBrush and additional examples, see the Painting with Solid Colors and Gradients Overview overview.

This code example is part of a larger example provided for the SolidColorBrush class. For the complete sample, see the Brushes Sample.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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.
Show:
© 2014 Microsoft