Silverlight: setting the background of the entire page

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
 
G

Göran Andersson

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>
 
V

VRSki

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
 
V

VRSki

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top