Defines objects used to paint graphical objects. Classes that derive from describe how the area is painted.
Assembly: System.Windows (in System.Windows.dll)
<object property="predefinedColorName"/> - or - <object property="#rgb"/> - or - <object property="#argb"/> - or - <object property="#rrggbb"/> - or - <object property="#aarrggbb"/> - or - <object property="sc#scR,scG,scB"/> - or - <object property="sc#scA,scR,scG,scB"/>
Thetype exposes the following members.
|Dispatcher||Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.)|
|Opacity||Gets or sets the degree of opacity of a .|
|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.|
|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 Silverlight 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.)|
For XAML syntaxes that take a , you need to specify one of the following:
A Color, specified as a string to directly fill a -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 as an object element, with the -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 .
For more information and examples of the XAML syntax and illustrations of the types of brushes, see Brushes.
A "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:
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.
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 , 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 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 type. However, if you use a markup extension such as Binding or StaticResource, you could reference any type of .
Possible XAML Usages of Brush Classes
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.