Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
785
HtmlViewer and Silverlight control sharing a container
posted

Hi,

 

In my SL app I've got to show both HTML and SL controls in the same container (but not at the same time).

My first take was to have a ContentControl and stick the SL control or HtmlViewer control inside whenever I want it. This works perfectly fine for SL controls but for the HtmlViewer there is a bit of initialization time. That means that as I make the HtmlViewer available I cannot access its elements through the DOM.

My solution was to have 2 containers within a Grid, the HtmlViewer and a ContentControl. If there's no content in the ContentControl, then the HtmlVIewer is seen, if there's some content in the ContentControl then the HtmlVIewer is hidden.

That works great in IE but FF insists on always sticking the HtmlViewer on top. THe ContentControl is visible but behind the Html so it can't be clicked.

 

Any idea how I could get around that?

 

Attached is a test project. Run it and click on the "show html" and "show control" buttons.

The right-hand side displays the correct content. In IE it works as expected (right-click on the red area and you see the SL context menu). Do the same in FF and right-click on the red area and you can see the HTML context menu.

HtmlViewerControlTest.zip
  • 760
    posted

    Hello,

    First of all, I can say that your way of using the XamHtmlViewer is not the standard one.

    If I had to create an SL application with XamHtmlViewer, I wouldn't use your approach.

    I think you'd better use the SourceUri property instead using an additional IFRAME element.

    Also you have to change the Visiblity property of the XamHtmlViewer in order to hide/show to control.

    Just removing all children from your custom IFRAME is not enough.

    I just added Visiblity= Visible/Collapsed to your code and it works fine under Firefox now.

    Regards, 

      Doychin Dochev

  • 5
    posted

    My issue is quite related where I can see the html content in a xamwebhtmlviewer in IE without any issue but in FireFox the HTML content is visible (more of a flicker) only on html load. What we also see is that even though the html viewer contents is not visible it is right on top because  no events fire (unable to click on them)  on the visible silverlight controls like button etc,  but when you right click you see the HTML context menu instead of seeing the Silverlight menu.

    In the sample code provided on http://labs.infragistics.com/silverlight/lobsamples/2009.2/ 

    I see that the XamWebHtmlViewer is wrapped in  <chrome:SimulatedWindow> where can I find this entire code?