Page view counter

Did You Know That... you must set isWindowless to true to use HTML overlays?

One of the parameters you pass in when creating a Silverlight object is the parameter isWindowless. That parameter defaults to false.

Normally, you do want isWindowlessto be set to false, because when it is set to true, you pay a very large performance penalty. However, there are two circumstances under which you must set it to true.

  1. If you want the background to be transparent, you must set isWindowless to true
  2. if you want to overlay an HTML control on top of your Silverlight control, you must set isWindowless to true.

The second issue of using an HTML overlay arises quite frequently. To see this at work, create a new Silverlight 1.0 application in Visual Studio 2008.

Add the following select statement to default.html

    <select id="colors"  style=" position:relative; left:20px; top:30px ">
        <option>"Black"</option>
        <option>"Red"</option>
        <option>"Orange"</option>
        <option>"Yellow"</option>
        <option>"Green"</option>
        <option>"Blue"</option>
        <option>"Indigo"</option>
        <option>"Violet"</option>
    </select>

Run the application and you'll see that the drop-down is immediately covered by the button created by the sample XAML. . As noted above, the default is for isWindowless to be false and therefore for Silverlight controls to be windowed. Windowed Silverlight controls have a z-index of 1 and are always on top.

Open up default.HTML.JS and change the isWindowless parameter to true, and run the application again. This time the HTML overlay appears on top of the Silverlight control. Windowless Silverlight controls do not have as z-index of 1, and so you can overlay HTM controls on top of them.

Published Saturday, December 15, 2007 3:34 PM by jesseliberty

Comments

# re: Did You Know That... you must set isWindowless to true to use HTML overlays?

Gorgeous look

Monday, December 17, 2007 5:51 PM by Syed sohail abbas

# Silverlight Cream for December 24, 2007 -- #158

Merry Christmas from SilverlightCream -- Here&#39;s a whole bunch of things that found it&#39;s way into

Monday, December 24, 2007 10:42 PM by Community Blogs

# Did You Know That... if you want your Silverlight control to have a transparent background, you must set isWindowless to true

As noted in an earlier Tip of the Day , typically you do not want a windowless Silverlight control, as

Friday, January 11, 2008 10:18 AM by Jesse Liberty - Silverlight Geek

# Did You Know That... if you want your Silverlight control to have a transparent background, you must set isWindowless to true

As noted in an earlier Tip of the Day , typically you do not want a windowless Silverlight control, as

Friday, January 11, 2008 10:30 AM by Microsoft Silverlight content