Silverlight: setting the background of the entire page

  • Thread starter Thread starter VRSki
  • Start date Start date
V

VRSki

I created a Silverlight application, which is hosted by an ASP.NET app
(default IDE settings for creating a Silverlight app). There are 2 projects
created by default: ASP.NET (hosting the Silverlight control) and the
Silverlight project with the control's code.

I'd like to set the background of the entire page as it appears on user's
browser to a certain color. Setting the background color on the Silverlight
control itself, only paints the controls area, but the rest of the background
is still the default white.

I tried different things:
- setitng the style in every <div> I could find in the asp.net side
- setting the silverlight control:
<asp:Silverlight ID="Xaml1" runat="server" ... PlugInBackColor="..." />
and
<asp:Silverlight ID="Xaml1" runat="server" ... BackColor="..." />

What am I missing? I noticed, in the App code (Silverlight), I can get
access to Host.Background, but it's readonly.

Any help is greatly appreciated.

VR
 
I created a Silverlight application, which is hosted by an ASP.NET app
(default IDE settings for creating a Silverlight app). There are 2 projects
created by default: ASP.NET (hosting the Silverlight control) and the
Silverlight project with the control's code.

I'd like to set the background of the entire page as it appears on user's
browser to a certain color. Setting the background color on the Silverlight
control itself, only paints the controls area, but the rest of the background
is still the default white.

I tried different things:
- setitng the style in every <div> I could find in the asp.net side
- setting the silverlight control:
<asp:Silverlight ID="Xaml1" runat="server" ... PlugInBackColor="..." />
and
<asp:Silverlight ID="Xaml1" runat="server" ... BackColor="..." />

What am I missing? I noticed, in the App code (Silverlight), I can get
access to Host.Background, but it's readonly.

Any help is greatly appreciated.

VR

Set the background of the body of the document. Add this in the <head>
tag of the page:

<style type="text/css">
body { background: red; }
</style>
 
Göran,

Thanks for the post. I tried that, but what I see is a brief flicker to red
upon the app's loading, and that it switches back to white. It appears as if
there is something else that hosts the control... can't figure out what it
is...

Any ideas?

Much appreciated,
VR
 
Got it. In addition to setting the color, control itself (ir I guess the
window that hosts it and created automatically), needs to be trasparent...

<asp:Silverlight ... PluginBackground="Transparent">

Thanks again for all the help.
 
Back
Top