Skip to main content

Microsoft Silverlight

Answered Question Silverlight GetElementById IE6RSS Feed

(0)

Kohan
Kohan

Member

Member

0 points

2 Posts

Silverlight GetElementById IE6

Hi, I have an odd error that you guys will hopefully be able to help me out with.

I have this code in my silverlight app:

private void MainGrid_SizeChanged(object sender, SizeChangedEventArgs e)
{
double acutalHeight = this.MainGrid.ActualHeight;
HtmlPage.Document.GetElementById("silverlightControlHost").SetStyleAttribute("height", string.Format("{0}px", acutalHeight));

}

which 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, looking at the page which is generated and looking into the style created it seems that the div is not getting correctly targetted, instead a new style which looks like this is created:

element.style {
HEIGHT: 856px (This is the desired hight which should have been set to my DIV named "silverlightControlHost")
}

Does anyone have any ideas how i can get this working as desired?

Thanks,
Kohan.

Jonathan Shen – MSFT
Jonathan...

All-Star

All-Star

24969 points

2,434 Posts

Microsoft
Answered Question

Re: Silverlight GetElementById IE6

Hi Kohan,

I have no IE6 environment now.  You can set its min-height property and have a try. Please let me know the result.

Best regards,

Jonathan

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Kohan
Kohan

Member

Member

0 points

2 Posts

Re: Silverlight GetElementById IE6

Thanks for the reply, However i believe IE6 ignores min-height; so this will have no effect. Cheers, Kohan

Jonathan Shen – MSFT
Jonathan...

All-Star

All-Star

24969 points

2,434 Posts

Microsoft

Re: Re: Silverlight GetElementById IE6

Hi Kohan,

min/max-height/width are not supported in IE6. To make it work, we need to do it like this.

selector {
min-height:500px;
height:auto !important;
height:500px;
}

or

div {
height:500px; /* defaults to this if JS is disabled */
height:BLOCKED EXPRESSION;
}
http://www.visibilityinherit.com/code/ie6-min-max-height-width.php

For your condition, we suggest you do this in a client javascript function and call it on code behind.  Please let me know the result.

Best regards,

Jonathan

 

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities