Bug 30380 - [UWP] WebView fails to display if contained within a StackLayout with LayoutOptions set
Summary: [UWP] WebView fails to display if contained within a StackLayout with LayoutO...
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.3.3
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-05-23 11:35 UTC by John Hardman
Modified: 2017-08-29 12:37 UTC (History)
8 users (show)

Tags: uwp, WebView, StackLayout, HorizontalOptions, LayoutOptions, ac, layout
Is this bug a regression?: ---
Last known good build:

repro project (514.16 KB, application/zip)
2017-01-10 17:31 UTC, Jimmy [MSFT]

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 30380 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description John Hardman 2015-05-23 11:35:57 UTC
On WinPhone, there is an interaction between WebView and the LayoutOptions of StackLayout. In the following code (slightly adapted from Forms Gallery), uncommenting the line so that HorizontalOptions is set results in the app failing to display the WebView. Comment the line out again and the WebView displays as expected.

Investigation shows that the WebView has Width and Height both set to -1.

using Xamarin.Forms;

namespace FormsGallery
    class WebViewDemoPage : ContentPage
        public WebViewDemoPage()
            WebView webView = new WebView
                Source = new UrlWebViewSource
                    Url = "http://blog.xamarin.com/",
                VerticalOptions = LayoutOptions.FillAndExpand

            // Build the page.
            this.Content = new StackLayout
                // Uncomment the below line and this will fail on WinPhone
                //HorizontalOptions = LayoutOptions.Start,
                Children = 
Comment 1 Ram Chandra 2015-07-01 09:18:43 UTC
I have checked this issue and I am also getting the reported behavior.

Observation: I observed that when I enable the following line webview is not working on windows. 
 HorizontalOptions = LayoutOptions.Start,

Screencast: http://www.screencast.com/t/tmmorVJmQ
IDE logs: https://gist.github.com/Parmendrak/b0cfd233467c0af27915

Please let me know if I can provide more info to this issue.

Note: I have checked the same on android and I am not getting this behavior with android.

Environment Info:

Xamarin.Forms: and

Windows 8.1
Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641
Installed Version: Professional
Xamarin   3.11.666.0 (ebae43a)
Xamarin.Android (5f55a9ef61c11b6ce0890bc91e4c71b1b92be214)
Xamarin.iOS (67b390d0d1bd741582cf7b7fd3ffea08583a3f83)
Comment 2 Jimmy [MSFT] 2017-01-10 17:31:49 UTC
Created attachment 19156 [details]
repro project

I can still reproduce this issue with Forms 2.3.3 and not only on WP8 but also on WinRT and UWP so this seems to affect all the Windows platforms.

If the StackLayout sets Horizontal/VerticalOptions to anything other than Fill/FillAndExpand then this issue will occur.

I've attached a repro project to the report.