Transparent background for isWindowless ='false'
Last post 04-29-2008 9:01 PM by Sergey Volk MSFT. 9 replies.
Sort Posts:
03-10-2008 4:02 AM
Transparent background for isWindowless ='false'

Hi,

I want my silverlight background to be transparent.

In my aspx page i am setting the background to be picture by using css property.

.body1{

background-image: url(../images/background/bg2.jpg);

margin:0;

    padding: 0px;

    height:100%;

    border:none;

    overflow: hidden;

}

I want my silverlight to have the same background as my page or to be transparent

but, I must to set the isWindowless: to 'false', because either way  i have display problems (on media center windows).

I tried to set the bakground by setting background:document.body.style.backgroundColor

and tried to set it transparent(and alpha colors) and it did not helped either.

Is there any way to set the silverlight background to be transparent and leave the isWindowless to be 'false'or maybe to set the background of silverlight to be picture too?

Thanks

nagina

Joined on 02-21-2008
Posts 8
03-10-2008 6:42 AM
Re: Transparent background for isWindowless ='false'

You must set transparency to the Silverlight Control...depending on how you're hosting Silverlight it can be different.  For example, in the Silverlight ASP.NET control, you simply set the following properties of the control:

<asp:Silverlight ... PluginBackground="Transparent" Windowless="true" /> 

Note that Background will color hte background of hte generated <div> not of the control itself.

(If this has answered your question, please "Mark as Answer")

Shawn Wildermuth
C# MVP, MCSD, Speaker and Author

Silverlight 2 Workshop
May 12-14, 2008 - Atlanta, GA
May 28-30, 2008 - San Francisco, CA
http://www.silverlight-tour.com

swildermuth

Joined on 10-13-2003
Atlanta, GA
Posts 1,058
03-10-2008 8:54 AM
Re: Transparent background for isWindowless ='false'

Actually , i did not understand.

I am using silverlight 1.0 , Visual Studio 2005 and  i am using silverlight control like this(this is aspx page).

<div id="SilverlightControlHost" >

<script type="text/javascript">

var parentElement = document.getElementById("SilverlightControlHost");

createSilverlight();

</script>

</div>

and this way i am creating silverlight

function createSilverlight()

{

//var scene = new photoGallery.Page();

Silverlight.createObjectEx({

source:
"Page.xaml",

parentElement: parentElement,

id:
"SilverlightControl",

properties: {

width:
"550",

height: "330",

background:'#459abf',

isWindowless: 'false',

version: "1.0"

},

events: {

onLoad: null

}

});

}

 is there anyway to set the transparency on div?

Thanks for the help,

Nagina

 

nagina

Joined on 02-21-2008
Posts 8
03-10-2008 2:33 PM
Re: Re: Transparent background for isWindowless ='false'

 not setting the div's color will always make it transparent, but since you have your SL's plugin color set to #459abf, then it will not be transparent, set the SL background:'transparent'

Greg
www.GJHDigital.com

GJHDigital

Joined on 12-26-2005
Posts 203
03-11-2008 2:41 AM
Re: Re: Transparent background for isWindowless ='false'

I did it at the beginning, in this case the background becomes to black,only if i set the isWindowless ='true' i am recieving the transparent background , but the view is corrupted.

 

 

 

nagina

Joined on 02-21-2008
Posts 8
03-11-2008 5:37 AM
Re: Re: Re: Transparent background for isWindowless ='false'

I agree with Greg, I've done this a hundred times and setting the Background: "Transparent" and the IsWindowless: "true" it should work.

(If this has answered your question, please "Mark as Answer")

Shawn Wildermuth
C# MVP, MCSD, Speaker and Author

Silverlight 2 Workshop
May 12-14, 2008 - Atlanta, GA
May 28-30, 2008 - San Francisco, CA
http://www.silverlight-tour.com

swildermuth

Joined on 10-13-2003
Atlanta, GA
Posts 1,058
04-26-2008 9:06 PM
Re: Re: Re: Transparent background for isWindowless ='false'

I ran into this same issue where I want the Silverlight plug-in to be transparent to show the HTML in the background, but when I set windowless to true, the entire app can't be displayed in Safari. (I'm running Safari on Windows, but the same thing happens on Safari on Mac as well).

Is there a work-around to set the windowless to true, but still have it work in Safari?

Thanks!

Jim @ imason

muzak9

Joined on 03-18-2008
Posts 6
04-27-2008 1:54 AM
Re: Re: Re: Re: Transparent background for isWindowless ='false'

I don't use Safari so I don't know of any workaround.  I suspect this is a bug.  Does it happen on Safari 2 and 3?

(If this has answered your question, please "Mark as Answer")

Shawn Wildermuth
C# MVP, MCSD, Speaker and Author

Silverlight 2 Workshop
May 12-14, 2008 - Atlanta, GA
May 28-30, 2008 - San Francisco, CA
http://www.silverlight-tour.com

swildermuth

Joined on 10-13-2003
Atlanta, GA
Posts 1,058
04-27-2008 11:23 AM
Re: Re: Re: Re: Transparent background for isWindowless ='false'

Yeah, probably is a bug. I've tried it with Safari 3 only..not sure about 2.

muzak9

Joined on 03-18-2008
Posts 6
04-29-2008 9:01 PM
Re: Re: Re: Re: Transparent background for isWindowless ='false'

Hmm, that's strange. I have just tried on Mac OS X Tiger and windowless SL plugin renders properly both in Safari 3.0.4 and FF 2.0.0.14 there. Actually we have a regression test which covers this particular scenario (Runs routinely on Mac OS X Leopard / Tiger both in Safari and FF. Safari 3 on Windows is not officially supported yet, so we don't run our tests there).

Probably something is wrong with your app. Does it render properly in Windows browsers? IE / FF?

As far as I know, there are some known performance issues with windowless plugins with Beta1 bits, but besides performance there should be no functional differences from Windows.

If this answers your question, please click on "Mark as Answer" on this post.

Sergey Volk MSFT

Joined on 03-21-2008
Posts 52