Fill (Glyphs)
Microsoft Silverlight will reach end of support after October 2021. Learn more.
<object Fill="colorString" .../>
-or-
<object>
<object.Fill>
singleBrush
</object.Fill>
</object>
value = object.Fill
object.Fill = 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 the Color reference topic. |
singleBrush |
Within opening and closing property elements for object.Fill, exactly one object element for an object that derives from Brush. The object element can be one of the following: LinearGradientBrush, RadialGradientBrush, ImageBrush, SolidColorBrush, VideoBrush. |
Property Value
Type: Brush
A value of type Brush.
This property is read/write. The default value is a null Brush, which is evaluated as Transparent.
Remarks
The first XAML syntax shown at the beginning of this topic is an attribute syntax. Use this syntax if you want the Fill to be a SolidColorBrush, which can be expressed as its Color value, for example "Red" or "#FF0000".
The second XAML syntax shown is a property element syntax. Use this syntax if you want the Fill to be a more complex brush than a SolidColorBrush, such as ImageBrush, LinearGradientBrush, or RadialGradientBrush.
If you are setting this property in script, the most common technique is to use the colorString grammar to specify the value as a string. Alternatively, you might set the value to an object such as LinearGradientBrush, by specifying the XAML that defines the brush as the input for CreateFromXaml and setting Fill to the CreateFromXAML output.
Note that the default Fill is null. Therefore, to render anything with Glyphs, you should specify a Fill either in XAML or script. This is in contrast to TextBlock.Foreground, which defaults to Black.