locked
Why can I not have another control on top of a WebView?

    Question

  • I do not seem to be able to place controls (e.g. buttons) on top of a web view.  Searching for this topic revealed this link:

    http://blogs.msdn.com/b/wsdevsol/archive/2012/10/18/nine-things-you-need-to-know-about-webview.aspx#AN2

    which includes a possible workaround, but it seems to involve copying a 'screen shot' of the web browser, hiding the browser and displaying the screen shot in it's place (how do you spell KLUDGE?), which is really not what I am looking for (I want the browser and the buttons to be 'live' simultaneously).

    Is there truly no way to do this?  On other platforms (e.g. iOS and Android) this is not a problem.

    Thanks. 

    Wednesday, December 26, 2012 5:43 PM

Answers

  • Hi John,

    Unfortunately there isn't a way around this. The WebView isn't a Xaml control and it hosts the web browser in a window above the Xaml layer's airspace. This is documented in the WebView docs.

    As Matt suggested in his article (and as suggested in the docs) you can avoid this when the WebView isn't live by replacing it with a WebViewBrush. There isn't a way to avoid this while keeping the WebView live. You would need to incorporate your buttons into the HTML page or place them outside of the bounds of the WebView.

    If interacting with a web page is central to your app then you may be better off using HTML and JavaScript rather than Xaml and C++ for your UI. You can implement your engine in C++ and expose it as a Windows Runtime Component.

    --Rob

    Wednesday, January 09, 2013 10:15 PM
    Owner