Share via


Background (Silverlight Plug-in)

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

Gets or sets the background color of the rectangular region that displays XAML content.

value = silverlightObject.settings.Background
silverlightObject.settings.Background = value

Property Value

Type: Color

Specifies the background color value as a string. This can either be a named color value, or an 8-bit or 16-bit color value, with or without alpha transparency.

Convention

Example

Description

Color name

"Red"

A named color value. For a listing of color names, see the "Remarks" section in Color.

8-bit RGB, no alpha

"#F00"

An 8-bit RGB value, in the form "#RGB".

8-bit RGB, alpha

"#8F00"

An 8-bit RGB value with alpha transparency, in the form "#ARGB".

16-bit RGB, no alpha

"#FF0000"

A 16-bit RGB value, in the form "#RRGGBB". For a listing of hexadecimal equivalents for color names, see the "Remarks" section in Color.

16-bit RGB, alpha

"#80FF0000"

A 16-bit RGB value with alpha transparency, in the form "#AARRGGBB". For a listing of hexadecimal equivalents for color names, see the "Remarks" section in Color.

scRGB, no alpha

"sc#1,0,0"

An ScRGB value with no alpha transparency, in the form sc#R,G,B.

scRGB, alpha

"sc#0.5,1,0,0"

An ScRGB value with alpha transparency in the form sc#A,R,G,B.

This property is read/write. The default value is null (see "Remarks"). For additional information about how this property is set during plug-in initialization, see Instantiating a Silverlight Plug-In (Silverlight 1.0).

Managed Equivalent

Background - but is read-only in the managed API. Can only be set through instantiation / object tag parameters.

Remarks

This property is available on the settings subobject of a Silverlight plug-in instance.

For rendering, a null value for the plug-in Background property is interpreted as the named color White.

If the Windowless property is set to true, or on Macintosh (where windowless mode is always active regardless of the Windowless setting) the Background property value can specify an alpha value for the color. The color value is then blended with the HTML page.

Important noteImportant Note:

Setting an alpha channel value for full or partial transparency has possible performance consequences, particularly in certain client environments.

In the following JavaScript examples, two Silverlight plug-ins are defined in CreateSilverlight.js. In the first example, the isWindowless initialization parameter is set to false; in the second example, isWindowless is set to true:

isWindowless:'false',       // Display as windowed.
background:'#80008080',     // Background color of plug-in (alpha + RGB).
isWindowless:'true',       // Display as windowless.
background:'#80008080',    // Background color of plug-in (alpha + RGB).

The background of the first Silverlight plug-in area will be opaque. The background of the second Silverlight plug-in will be blended with the background image of the HTML page.

The script syntax shown is for using the Background property at run time. You can also set the property during initiation, using either object param syntax or the silverlight.js helper functions. See Background (Silverlight Plug-in Object).

Applies To

Silverlight Plug-in

See Also

Reference