none
WPF Webbrowser - Access to Document Body on IE11 RRS feed

  • Pergunta

  • I am developing a Desktop application which stores the GUI layer on html files as embedded resources. And the app has a WPF Web Browser component that manages the user interface lifecycle. I'm able to do all the job with no problems on IE 10 (10000). But I've recently found out that when setting the FEATURE_BROWSER_EMULATION to IE 11 (11000) the document body becomes inaccessible.

    The example below shows how to get the document body OffsetHeight:

    dynamic document = (this.wbContent.Document as dynamic);
    if ((document == null) || (document.body == null)) return 0;
    return document.body.OffsetHeight;

    The HTML is:

    <html>
        ...
        <body style="width: 170px; height: 240px">
            ...
        </body>
    </html>

    When using IE 10 it returns 240.
    When using IE 11 the document.body shows 'null' on debugger, but it strangely passes the check test and throws a "
    Microsoft.CSharp.RuntimeBinder.RuntimeBinderException". This behavior is only observed on the first time the user tries to open the window per each application instance. From second time upward it works perfectly.

    Thank you!



    • Editado L. G. Silva quarta-feira, 18 de maio de 2016 20:03
    quarta-feira, 18 de maio de 2016 19:49