Поделиться через


Silverlight 1.1 updates on Vista Gadgets

In my previous post I wrote about "Transparent Silverlight Sidebar Gadgets"!

Now a reader sent me a comment about the new Silverlight 1.1 Alpha Refresh, and the gadget not working there.

So I updated the example and replaced the Silverlight.js files with the newester version!

Here is the updated version of what you need to do to create a transparent sidebar gadget with Silverlight in it:

  • Add the JavaScript call createSilverlight(); to your gadget's HTML page (for all SL gadgets)

  • Add the special sidebar's "g:background" layer and set the background-image to a transparent PNG file
    <g:background src="bg.png" mce_src="bg.png" id="Bg" style="position:absolute;width:130px;height:130px;z-index:-1"/>

  • The next thing is, you need to remove the Background attribute of the XAML's root canvas

  • Set two properties of the Silverlight Control:

    function createSilverlight()
    {
        Silverlight.createObjectEx({
           ...
            properties: { ...
                    isWindowless: "true",
                    background:'#00000000'

           }

    }

    This way the Silverlight control will have no window (allowing it to be dragged around) and will have a transparent background (letting the desktop shine through)

The updated version of the Silverlight Gadget is attached to this posting!

SilverlightFun11.Gadget.zip

Comments

  • Anonymous
    August 08, 2007
    PingBack from http://blogs.msdn.com/knom/archive/2007/06/06/my-first-silverlight-sidebar-gadget.aspx

  • Anonymous
    August 13, 2007
    The anti aliasing issue really does spoil this.  Is there a way round it? Can we switch off anti-aliasing for the contents of a canvas?  I noticed textblocks do not display either.  Still sweet tho! M

  • Anonymous
    September 29, 2007
    Yep, there is a way to remove aa-related pink borders. Just rewrite the host div with this style:  <div id="SilverlightControlHost" class="silverlightHost" style="filter:progid:DXImageTransform.Microsoft.Alpha(opacity=100);"> This removes semi-transparent borders and so on, but what I really want - SL transparent figures and desktop shining through them - seems impossible ( Any ideas?