Note that there are some explanatory texts on larger screens.

plurals
  1. POSilverlight GetElementById IE6
    text
    copied!<p>I have an odd error that you guys will hopefully be able to help me out with. </p> <p>I have this code in my silverlight app: </p> <pre><code>private void MainGrid_SizeChanged(object sender, SizeChangedEventArgs e) { double actualHeight = this.MainGrid.ActualHeight; HtmlPage.Document.GetElementById("silverlightControlHost").SetStyleAttribute("height", string.Format("{0}px", actualHeight)); } </code></pre> <p>This basically resizes my container div so that it fits in the browser. This is working fine in IE7+, Firefox and Chrome. The problem is that in IE6 this is not working. And im not sure why.</p> <p>Page markup:</p> <pre><code> &lt;style type="text/css"&gt; #silverlightControlHost { height: 10px; //This gets resized in Chrome/IE7+/Firefox text-align: center; } &lt;/style&gt; &lt;script type="text/javascript" src="../Silverlight.js"&gt;&lt;/script&gt; &lt;/asp:Content&gt; &lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"&gt; &lt;div id="silverlightControlHost"&gt; &lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%"&gt; &lt;param name="enablehtmlaccess" value="true"/&gt; &lt;param name="source" value="../ClientBin/myAppXap.xap" /&gt; &lt;param name="onError" value="onSilverlightError" /&gt; &lt;param name="background" value="white" /&gt; &lt;param name="minRuntimeVersion" value="3.0.40624.0" /&gt; &lt;param name="autoUpgrade" value="true" /&gt; &lt;a href="http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=3.0.40624.0" style="text-decoration: none"&gt; &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt; &lt;/a&gt; &lt;/object&gt; &lt;iframe id="_sl_historyFrame" style="visibility: hidden; height: 0px; width: 0px; border: 0px"&gt;&lt;/iframe&gt; &lt;/div&gt; &lt;/asp:Content&gt; </code></pre> <p>Does anyone have any ideas how i can get this working as desired? </p> <p>Thanks, Simon</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload