Brush Class
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Defines objects used to paint graphical objects. Classes that derive from Brush describe how the area is painted.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
The Brush type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Dispatcher | Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.) |
![]() | Opacity | Gets or sets the degree of opacity of a Brush. |
![]() | RelativeTransform | Gets or sets the transformation that is applied to the brush using relative coordinates. |
![]() | Transform | Gets or sets the transformation that is applied to the brush. |
| Name | Description | |
|---|---|---|
![]() | CheckAccess | Determines whether the calling thread has access to this object. (Inherited from DependencyObject.) |
![]() | ClearValue | Clears the local value of a dependency property. (Inherited from DependencyObject.) |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetAnimationBaseValue | Returns any base value established for a Windows Phone dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | GetValue | Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ReadLocalValue | Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.) |
![]() | SetValue | Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | OpacityProperty | Identifies the Opacity dependency property. |
![]() ![]() | RelativeTransformProperty | Identifies the RelativeTransform dependency property. |
![]() ![]() | TransformProperty | Identifies the Transform dependency property. |
For XAML syntaxes that take a Brush, you need to specify one of the following:
A Color, specified as a string to directly fill a Brush-type property in XAML attribute form. That string is implied to create a SolidColorBrush to fill the value, and the Color you specify becomes the Color property value. This is the syntax shown in the "XAML Attribute Usage" and "XAML Values" sections of this topic.
A nonabstract derived type of Brush as an object element, with the Brush-type property in question being specified in property element form. For details, see the XAML syntax on the reference pages for SolidColorBrush, LinearGradientBrush, RadialGradientBrush, ImageBrush, and VideoBrush. It is also possible to derive custom types from Brush.
AStaticResource, Binding or TemplateBinding reference to an existing Brush.
A Brush "paints" an area with its output. Different brushes have different types of output. Some brushes paint an area with a solid color, gradient, or image. The following list describes the different types of brushes:
SolidColorBrush: Paints an area with a solid Color.
LinearGradientBrush: Paints an area with a linear gradient.
RadialGradientBrush: Paints an area with a radial gradient.
ImageBrush: Paints an area with an image.
VideoBrush: Paints an area with a running video.
Predefined Colors
You can paint using a SolidColorBrush that uses a predefined solid color. This can either be a static property name of Colors, or one of another set of color names that are processed directly as strings if specified as a XAML attribute value. See Color or SolidColorBrush for a table of named colors, and instructions on how to specify named colors in code. To use a predefined color, you can use the XAML attribute syntax for any property that takes a Brush, using the named color convention. Or you can create a SolidColorBrush and specify its Color value as a XAML attribute, using the named color convention.

Brushes in XAML
The following table lists the different Brush types that can be used in XAML and the syntax they support. For detailed syntax information for a specific brush, see that brush's type page.
The XAML Attribute Usage in this topic is specifically the SolidColorBrush attribute syntax. The SolidColorBrush syntax is the default behavior if you specify an attribute value string for any property that expects a Brush type. However, if you use a markup extension such as Binding orStaticResource, you could reference any type of Brush.
Possible XAML Usages of Brush Classes
Class | Attribute Syntax | Object Element Syntax |
|---|---|---|
Yes | Yes | |
No | Yes | |
No | Yes | |
No | Yes | |
No | Yes |




