tags:

views:

5635

answers:

6

I currently have a silverlight application which rotates through several graphs of live data. Each page has two user controls though: one for an info box at the top and another for the graph to display. I have tried to add a background image to the master page that they are displayed on so that the image is behind everything but as soon as they load, they overwrite the image with their blank canvas.

So far attempts to make the background of the user controls transparent have had no effect.

Any help would be greatly appreciated.

A: 

There is surely something inside the user controls that has a white background, you could probably find it using Blend, or maybe using Silverlight Spy. Spy is a great app that allows you to see the visual tree of a running app, among other things.

MaxM
A: 

Thanks that silverlight spy is quite useful.

The thing is that I have set "background= transparent" on all of the layout roots of the silverlight controls as well as the silverlight object that is placed in the aspx page and set the background to have 0 opacity again in the code behind of the master but it doesn't do anything. After checking spy, the opacity is still 1.

I cannot use Expression Blend because the pages are made using Visifire Charts in the code behind.

+2  A: 

You need to set the background to be transparent on the host control itself, not just in the xaml files that get loaded. If you're using the object tag you would do something like:

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
    <param name="source" value="[your xap file]"/>
    <param name="background" value="transparent" />
         ....
</object>

Because the actual silverlight host control has a background color, if you don't set it to be transparent it will default to white which will overwrite your background regardless of if your canvas is transparent.

Bryant
A: 

Thanks Bryant, that is having a bit more effect now. I had previously tried setting the background on the object using a style sheet but didn't know it had to be done in the params. Unfortunately, it still isn't working quite as I hoped as the background is now black on the silverlight control rather than displaying the background of the master page.

+2  A: 

It is now working perfectly. It needed

<param name="windowless" value="true" />

as well as setting the background to transparent.

Thanks for your help, it was much appreciated.

A: 

Thank you. Page Background-image attach field?