How To Give a Silverlight 2 Gadget a Transparent Background
Warning: This is a poor solution if your gadget has any level of dragging interaction in it. The “windowless=true” step will make it so that any dragging interaction will be interrupted by the gadget, which will interpret such a move as an attempt to drag the gadget off the side bar.
Giving your Silverlight gadget a transparent background is actually quite simple. First, follow the directions from Chris Szurgot’s post on Silverlight gadgets. No point in duplicating his work.
When you’re done, create a transparent png file. Or download this one.
Now, head over to your html file. Get rid of all CSS background information. Add the following just below the body tag:
Finally, change the following params in the Silverlight object host.
<param name=”background” value=”transparent” />
<param name=”windowless” value=”true” />
And that’s it.
Additional Warning: It looks like there is no solution yet for the pink halo around any anti-aliased pixels in a Silverlight gadget.
This is a problem that transparent Silverlight gadgets have had for some time now. If that doesn’t bother you then you’re all set.
0 Responses to How To Give a Silverlight 2 Gadget a Transparent Background
The pink borders does bother me. lol. do anyone have any idea of overcoming this problem?
Pingback: Designer WPF » Blog Archive » Tips for Creating a Silverlight 2 Gadget for Vista