Hello,
I have created a simple silverlight application to display some text at realtime from xml. The text display using HTML DIV tag. I have added plugin property windowless=true, enablehtmlaccess=true,background=transparent.
On Silverlight I have added a Button "Continue" at Top & Bottom, which shows some message on that click.
Silverlight Plugin resize based in XML contents.
My code :
MainPage.xaml:
<Grid x:Name="LayoutRoot">
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top">
<Button x:Name="topContinue" Content="Continue" Margin="0,30,30,0" Click="Continue_Click"></Button>
</StackPanel>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom">
<Button x:Name="bottomContinue" Content="Continue" Margin="0,0,30,30" Click="Continue_Click"></Button>
</StackPanel>
</Grid>
MainPage.xaml.cs:
Creating HTML DIV on Application Start using :
HtmlDocument _document = HtmlPage.Document;
HtmlElement iDIV = _document.CreateElement("DIV");
iDIV.SetAttribute("id", "divHTMLViewer");
iDIV.SetStyleAttribute("position", "absolute");
iDIV.SetStyleAttribute("z-index", "1");
iDIV.SetStyleAttribute("display", "INLINE");
iDIV.SetStyleAttribute("top", "100px");
iDIV.SetStyleAttribute("height", "0px");
iDIV.SetStyleAttribute("width", "96%");
iDIV.SetStyleAttribute("left", "15px");
iDIV.SetStyleAttribute("text-align", "justify");
HtmlElement body = _document.GetElementsByTagName("BODY")[0] as HtmlElement;
body.RemoveChild(iDIV);
body.AppendChild(iDIV);
Set the XML text :
HtmlElement divHTMLViewer = HtmlPage.Document.GetElementById("divHTMLViewer");
sText = sText.Replace("<", "<").Replace(">", ">");
divHTMLViewer.SetStyleAttribute("display", "none");
divHTMLViewer.SetStyleAttribute("width", "96%");
divHTMLViewer.SetStyleAttribute("top", "100px");
divHTMLViewer.SetStyleAttribute("left", "15px");
divHTMLViewer.RemoveStyleAttribute("color");
divHTMLViewer.RemoveStyleAttribute("fontSize");
divHTMLViewer.SetProperty("innerHTML", sText);
divHTMLViewer.SetStyleAttribute("display", "INLINE");
setSilverlightControlHeight(UILAYOUT.INSTRUCTIONS);
Silverlight Plugin size increase code :
isilverlightControlHost.SetStyleAttribute("height", HtmlPage.Window.Eval("document.documentElement.scrollHeight").ToString() + "px");
isilverlightControlHost.SetStyleAttribute("position", "absolute");
All these code is working fine in Internet Explorer, Crome & Safari but "Continue" not visible in FIREFOX ONLY.
So is there any issue with this code ?
Code Sample :http://lm-bucket-for-forum-post.s3.amazonaws.com/HtMLViewerSilverLight.zip
working sample : Just replace ".zip" with "TestPage.html" in above URL.
Please let me know how can I solve it ?
Thanks in advance, Laxmilal Menaria