Welcome to Pete Brown's 10rem.net

First time here? If you are a developer or are interested in Microsoft tools and technology, please consider subscribing to the latest posts.

You may also be interested in my blog archives, the articles section, or some of my lab projects such as the C64 emulator written in Silverlight.

(hide this)

Make Silverlight Control Transparent

Pete Brown - 09 June 2007

It's not immediately obvious how to make the background of your Silverlight control (1.1 in this case) transparent.

The way to do it is to modify the "createSilverlight" function in page.extension.js (like Default.aspx.js) to set the background to a transparent color and the isWindowless property to true. You'll then be able to see through your Silverlight control to the page behind it.

function createSilverlight()
{
 Sys.Silverlight.createObjectEx({
  source: "Page.xaml",
  parentElement: document.getElementById("SilverlightControlHost"),
  id: "SilverlightControl",    
  properties: {
   width: "100%",
   height: "100%",
   version: "0.95",
   isWindowless:"true",
            background:"#00FFFFFF",

   enableHtmlAccess: true
  },
  events: {}
 });
}

 
posted by Pete Brown on Saturday, June 9, 2007
filed under:  

Comment on this Post

Remember me

1 trackback for “Make Silverlight Control Transparent”

  1. Michael's Blogsays:
    During the weekend I found several new examples about Silverlight . Because I'm running several Web sites