Page view counter

Silverlight Tips of the Day - Blog by Mike Snow

Game Programming with Silverlight

Silverlight Tip of the Day #11 – How to make your Silverlight Control Transparent.

In order to make your Silverlight control transparent to the background of your web site you have to do two things.

From an ASPX page:

  1. Add the tag PluginBackground="Transparent" to your Silverlight control.
  2. Add the tag Windowless="true" to your Silverlight control.

Example:

<asp:Silverlight PluginBackground="Transparent" Windowless="true" ID="Xaml1" runat="server" Source="~/ClientBin/SilverlightApplication4.xap" MinimumVersion="2.0.30523"  />

From an HTML page:

  1. Add the param: <param name="background" value="Transparent" /
  2. Add the param: <param name="windowless" value="true" />

Example:

<object data="data:application/x-silverlight," type="application/x-silverlight-2-b2" >
<param name="source" value="ClientBin/SilverlightApplication4.xap"/>
<param name="onerror" value="onSilverlightError" />
<param name="pluginbackground" value="Transparent" />
<param name="windowless" value="true" /> 
</object>

Notes:

By default your Silverlight control takes up the entire page. This is because the Width and Height are set to 100%. If you want the control to only consume part of the page change these values to represent what you want. For example, to make the control 400x400 pixels on the page you can set it like this:

<asp:Silverlight Width="400px" Height="400px" PluginBackground="Transparent" Windowless="true" ID="Xaml1" runat="server" Source="~/ClientBin/SilverlightApplication4.xap" MinimumVersion="2.0.30523"  />

Thank you,
--Mike Snow

 Subscribe in a reader

Comments

Microsoft Weblogs said:

In order to make your Silverlight control transparent to the background of your web site you have to

# June 26, 2008 4:59 PM

Ian Blackburn said:

Silverlight Transparency - use PluginBackground not Background!

# June 27, 2008 3:05 AM

Dew Drop - June 27, 2008 | Alvin Ashcraft's Morning Dew said:

Pingback from  Dew Drop - June 27, 2008 | Alvin Ashcraft's Morning Dew

# June 27, 2008 8:25 AM

Community Blogs said:

Jaime Rodriguez on DeepZoom, Pete Brown on on Publish/Subscribe pattern in SL, Shawn Wildermuth on XAML

# June 27, 2008 6:12 PM

Silverlight news for June 30, 2008 said:

Pingback from  Silverlight news for June 30, 2008

# June 30, 2008 3:41 AM

Visual Web Developer Team Blog said:

Interested in learning something new about Silverlight almost every day? I will be posting “Tips of the

# July 1, 2008 1:54 PM

14 Silverlight Tips | DavideZordan.net said:

Pingback from  14 Silverlight Tips | DavideZordan.net

# July 2, 2008 4:31 AM

???????????????? ?????????????? - “Business Class. ????????????????” said:

Pingback from  ???????????????? ?????????????? - &#8220;Business Class. ????????????????&#8221;

# July 12, 2008 4:33 PM

Silverlight - Tip of the Day by Mike Snow at Blog von J??rgen Ebner said:

Pingback from  Silverlight - Tip of the Day by Mike Snow at Blog von J??rgen Ebner

# July 28, 2008 7:06 AM

Silverlight Tips of the Day - Blog by Mike Snow said:

The purpose of this post is to create an outline summary all the blogs from my Silverlight Tips of the

# January 4, 2009 6:50 PM