Brian
Brian

Reputation: 23

How to navigate from a xaml page to a blazor page in .NET Blazor Maui Hybrid

Does anyone know how we can navigate from a xaml page to a specific razor page inside a Blazor Maui Hybrid application? I know that it is possible to navigate from a blazor page to a xaml page according to this tread but can't find a way to do it the other way around. Any help would be appreciated.

Upvotes: 1

Views: 978

Answers (1)

Hongxin Sui-MSFT
Hongxin Sui-MSFT

Reputation: 199

You may use the code below to navigate from a xaml page to a blazor page.

 <Button class="btn btn-secondary" Clicked="Button_Clicked"/>
 private void Button_Clicked(object sender, EventArgs e)
{
    App.Current.MainPage.Navigation.PushModalAsync(new MainPage());
}

For more details, you may refer to the link:"https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/routing?view=aspnetcore-6.0".I will follow up if there are any problems.

Upvotes: 1

Related Questions