Freigeben über


Color (SolidColorBrush)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the color of a SolidColorBrush.

<object Color="colorString"  .../>
value = object.Color
object.Color = value

XAML Values

Value

Description

colorString

The Color for a SolidColorBrush expressed as an attribute string. This can be a named color, an RGB value, or an ScRGB value. RGB or ScRGB may also specify alpha information. See the "colorString Grammar" section in Color.

Property Value

Type: Color

The brush's color.

This property is read/write. The default value is null, which is evaluated as Transparent for rendering purposes.

Managed Equivalent

Color

Remarks

For a list of colors, and the script and XAML usages for all properties that take a Color, see the Color reference topic.

You cannot specify a Brush object element such as LinearGradientBrush for this property value by using property element syntax. You can only use XAML attribute syntax to set Color to a color string, as documented in the "colorString Grammar" section of the Color reference topic.

Setting this property in JavaScript also requires the colorString grammar to specify the value as a string, unless you set it to the value of another object's property that is also a Color. See the "Remarks" section in the Color reference topic for additional information about the scripting usage of the Color object.

If you deliberately set a Transparent value, as opposed to a null value, the value can be hit tested and will intercept mouse actions that you might have intended for objects beneath the transparency.

For more information on basic concepts, see Brushes. Note that the Brushes topic is written primarily for users of the managed API, and may not have code examples or specific information that address the JavaScript API scenarios.

Applies To

SolidColorBrush