Background Property (Silverlight Plug-in)
Gets or sets the background color of the rectangular region that display XAML content.
Scripting (Instantiation) |
Silverlight.CreateObject(,,,{background:'colorValue'})
-or-
Silverlight.CreateObjectEx({properties:{background:'colorValue'}})
|
Scripting (Runtime) |
value = silverlightObject.settings.Background silverlightObject.settings.Background = value |
Property Value
Specifies the background color value as a string, which 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 | "#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 | "#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 no alpha transparency in the form sc# A,R,G,B. |
This property is read/write. The default value is null (see Remarks). For more information on how this property is set during plug-in initialization, see Instantiating a Silverlight Plug-in (Using CreateSilverlight.js and Silverlight.js).
Remarks
This property is available on the settings sub-object 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 the window-less 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 Setting an alpha channel value for full or partial transparency has possible performance consequences, particularly on certain client environments. See Performance Tips.
Consider the following JavaScript examples in which the two Silverlight plug-ins are defined in CreateSilverlight.js--the first one with the isWindowless initialization parameter set to false; the second, with isWindowless set to true:
JavaScript |
---|
isWindowless:'false', // Display as windowed. background:'#80008080', // Background color of plug-in (alpha + RGB). |
JavaScript |
---|
isWindowless:'true', // Display as window-less. background:'#80008080', // Background color of plug-in (alpha + RGB). |
Notice the displayed output of the preceding plug-in initializations. The background of the first Silverlight plug-in area is opaque. The background of the second Silverlight plug-in are is blended with the background image of the HTML page.
Windowless property set on two Silverlight plug-ins
Applies To
See Also
Silverlight Object Models and Scripting to the Silverlight Plug-in
Instantiating a Silverlight Plug-in (Using CreateSilverlight.js and Silverlight.js)
Color
Windowless