I have a basic MAUI Blazor Hybrid app with one xaml page: MainPage.xaml and in it there is one component, the BlazorWebView
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="MyApp.MainPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls"
xmlns:local="clr-namespace:MyApp"
ios:Page.UseSafeArea="True"
BackgroundColor="{DynamicResource PageBackgroundColor}">
<BlazorWebView x:Name="blazorWebView" HostPage="wwwroot/index.html">
<BlazorWebView.RootComponents>
<RootComponent ComponentType="{x:Type local:Components.Routes}" Selector="#app" />
</BlazorWebView.RootComponents>
</BlazorWebView>
</ContentPage>
I would like to be able to reload the BlazorWebView’s content (load it as though I just arrived at the MainPage.xaml)
I tried doing
var hostPage = blazorWebView.HostPage;
blazorWebView.HostPage = null;
blazorWebView.HostPage = hostPage;
but this had no effect.
Even setting blazorWebView = null;
did nothing