0

I'm trying to navigate back from the page I have been routed. I have registered all pages as well.

I have Home Page with List view. When clicking ListView Item I'm navigation to DetailsPage from there again I'm navigating to RecordPage. Now when I'm clicking back button on RecordPage, which comes automatically, it throws this exception.

Here is what I have done

AppShell.xaml

<Shell
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:MyApp.Mobile.UI;assembly=MyApp.Mobile.UI"
    Shell.FlyoutBehavior="Disabled">

    <ShellContent
        ContentTemplate="{DataTemplate local:HomePage}"
        Route="InspectionListPage" />

</Shell>

App.xaml.cs

public partial class App : Application
{
    public App()
    {
        InitializeComponent();
        MainPage = new AppShell();

        Routing.RegisterRoute(nameof(LoginPage), typeof(LoginPage));
        Routing.RegisterRoute(nameof(HomePage), typeof(HomePage));
        Routing.RegisterRoute(nameof(DetailsPage), typeof(DetailsPage));
        Routing.RegisterRoute(nameof(RecordPage), typeof(RecordPage));
    }
}

enter image description here

Divyesh
  • 2,085
  • 20
  • 35
  • I think you can either remove `` OR remove `Routing.RegisterRoute(nameof(HomePage), typeof(HomePage));`. Which is better depends on how you use these routes. OTOH, those two routes "shouldn't" be "ambiguous", because even though they both open HomePage, one gives it a route named "InspectionListPage", which is a different name. I don't know exactly what is going on, but its worth a try. – ToolmakerSteve Jul 28 '22 at 23:26
  • I did a test,but I couldn't reproduce this problem. Could you please post a basic demo so that we can try to reproduce this problem on my side? – Jessie Zhang -MSFT Jul 29 '22 at 02:44

0 Answers0