locked
The silverlight object tag RRS feed

  • Question

  • I think this might be more of a DOM question but here goes. So the silverlight tool I built will change in height. When I place the control on my webpage (code below) I need to make the object container large enough for the tool at full height. Now the problem is that the object background is white where my tool does not take up that space and the web page is light blue. Can I make the background of the object space a color? I have looked up the object item on the web but did not find any bgcolor property to set. Any ideas?

    <object width="230" height="380"
        data="data:application/x-silverlight-2,"
        type="application/x-silverlight-3" >
        <param name="source" value="ClientBin/SilverlightWeatherControl.xap"/>
    </object>

    Friday, March 5, 2010 1:22 PM

Answers

  • You can set the background parameter.

    <param name="background" value="blue" />
     
    Friday, March 5, 2010 1:27 PM
  • you can also use Transparent like below to allow the Page color to show through

      

    <param name="background" value="Transparent"/>
     

    However you will need to set Windowless to True for the transparency to work, this does have a performance impact (at least thats what I've read) but I am using it on a very complex Silverlight App and see virtually no detectable performace difference between have Windowless enabled and disabled.

      

    <param name="windowless" value="true" />
    Friday, March 5, 2010 2:01 PM
  • Hi, 

    I had to deal with the same kind of issue more than once.
    Often some clients insist for having a gradient background and
    no matter how complex the app is, the .xap still resides on a web page and
    they were some always some little holes here and there to cover.... sooooo......  
    <param name="background" value="Transparent" /> did the trick...

    <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
          <param name="source" value="ClientBin/mySilverlightApp.xap"/>
          <param name="onError" value="onSilverlightError" />
          <param name="background" value="Transparent" /><---------
          <param name="windowless" value="true" /><-----------
          <param name="minRuntimeVersion" value="3.0.40624.0" />
          <param name="autoUpgrade" value="true" />
       <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none">
       <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
       </a>
    </object>

    In the above case the width and height were set to 100%, though if you want
    the .xap control to only consume part of your Web page (i.e. width="230" & height="380") you can easily change
    to values with the values (pixels static width and height) you want.

    If this answers your question, please select Mark as an answer. Thank you.

    Friday, March 5, 2010 2:59 PM

All replies

  • You can set the background parameter.

    <param name="background" value="blue" />
     
    Friday, March 5, 2010 1:27 PM
  • you can also use Transparent like below to allow the Page color to show through

      

    <param name="background" value="Transparent"/>
     

    However you will need to set Windowless to True for the transparency to work, this does have a performance impact (at least thats what I've read) but I am using it on a very complex Silverlight App and see virtually no detectable performace difference between have Windowless enabled and disabled.

      

    <param name="windowless" value="true" />
    Friday, March 5, 2010 2:01 PM
  • Hi, 

    I had to deal with the same kind of issue more than once.
    Often some clients insist for having a gradient background and
    no matter how complex the app is, the .xap still resides on a web page and
    they were some always some little holes here and there to cover.... sooooo......  
    <param name="background" value="Transparent" /> did the trick...

    <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
          <param name="source" value="ClientBin/mySilverlightApp.xap"/>
          <param name="onError" value="onSilverlightError" />
          <param name="background" value="Transparent" /><---------
          <param name="windowless" value="true" /><-----------
          <param name="minRuntimeVersion" value="3.0.40624.0" />
          <param name="autoUpgrade" value="true" />
       <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none">
       <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
       </a>
    </object>

    In the above case the width and height were set to 100%, though if you want
    the .xap control to only consume part of your Web page (i.e. width="230" & height="380") you can easily change
    to values with the values (pixels static width and height) you want.

    If this answers your question, please select Mark as an answer. Thank you.

    Friday, March 5, 2010 2:59 PM
  •  Thank you all. I went transparent and it looks really good. Is there an alignment param? Or rather then me bugging you all, is there a site with a list? Thank you very much.

    Friday, March 5, 2010 5:31 PM
  • You can find the list of object parameters here (left panel under Silverlight Plug-in Object Reference)

    http://msdn.microsoft.com/en-us/library/cc838259(VS.95).aspx

    Friday, March 5, 2010 6:34 PM