Hello,
Please add <ScrollView>
outside the webview, then other controls will render normally like following code.
<ScrollView>
<VerticalStackLayout
Padding="30,0"
Spacing="25">
<Image
x:Name="muImage"
Source="dotnet_bot.png"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="dot net bot in a race car number eight" />
<Label
Text="Hello, World!"
Style="{StaticResource Headline}"
SemanticProperties.HeadingLevel="Level1" />
<Label
Text="Welcome to .NET Multi-platform App UI"
Style="{StaticResource SubHeadline}"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I" />
<ScrollView>
<WebView x:Name="webView" >
<WebView.Source>
<HtmlWebViewSource>
<HtmlWebViewSource.Html>
<![CDATA[
<html>
<head>
</head>
<body>
<h1>.NET MAUI</h1>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
<p>The CSS and image are loaded from local files!</p>
</body>
</html>
]]>
</HtmlWebViewSource.Html>
</HtmlWebViewSource>
</WebView.Source>
</WebView>
</ScrollView>
<Button
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Fill" />
</VerticalStackLayout>
</ScrollView>
I find this issue only happened when you use HtmlWebViewSource
, if you use url source, webview could show normally. You can report this issue in the MAUI GitHub repo as well.
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.