Issue
I am new to .Net MAUI platform. I am trying to load WebView, but I want to pass the URI source dynamically to the webview. I am using VisualStudio 2022 for Mac. I tried this in my MainPage.xaml file,
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="FirstMaui.MainPage">
<WebView x:Name="webview"> </WebView>
</ContentPage>
In my MainPage.xaml.cs file,
public MainPage()
{
InitializeComponent();
webview.source = "";
}
Here, the webview is not exposed in this context. How to overcome this?
Solution
If you mean you can’t see the webview then try adding the RequestHeight and RequestWidth. e.g.
<WebView x:Name="webview" HeightRequest="300" WidthRequest="300" > </WebView>
Answered By – still-got-the-t-shirt
Answer Checked By – Candace Johnson (FlutterFixes Volunteer)