Im getting error when trying to navigate back from pushed page
System.ArgumentException: 'Ambiguous routes matched for: //D_FAULT_TabBar14/IMPL_BooksPage/BooksPage/D_FAULT_ModalReader16 matches found: //D_FAULT_TabBar14/IMPL_BooksPage/BooksPage/D_FAULT_ModalReader16,//D_FAULT_TabBar14/IMPL_BooksPage/BooksPage/D_FAULT_ModalReader16 (Parameter 'uri')'
Im using Shell navigation
<TabBar
Shell.NavBarIsVisible="False"
Shell.TabBarBackgroundColor="{DynamicResource Background}"
Shell.TabBarForegroundColor="{DynamicResource HighlightedItem}"
Shell.TabBarTitleColor="{DynamicResource HighlightedItem}"
Shell.TabBarUnselectedColor="{DynamicResource DarkerBackground}">
<ShellContent
Title="წიგნები"
ContentTemplate="{DataTemplate pages:BooksPage}"
Icon="open_book.svg"
Route="BooksPage" />
......
From BooksPage then i go to Reader like this
ModalReader mr = new ModalReader(book);
await Shell.Current.Navigation.PushAsync(mr, true);
from Reader to Bookmarks
BookmarksModal bm = new BookmarksModal(_viewModel.Book?.Title ?? "usaxelo", _viewModel.Sarchevi, (int x) =>
{
Carousel.ScrollTo(x, animate: false);
});
await Shell.Current.Navigation.PushAsync(bm, true);
and when i try to pop that one exception is thrown
await Shell.Current.Navigation.PopAsync();
what am i do wrong?
registered routes and dependecies but still same error
public AppShell()
{
InitializeComponent();
Routing.RegisterRoute(nameof(Authenticator), typeof(Authenticator));
Routing.RegisterRoute(nameof(MainPage), typeof(MainPage));
Routing.RegisterRoute(nameof(LoginPage), typeof(LoginPage));
Routing.RegisterRoute(nameof(BooksPage), typeof(BooksPage));
//Routing.RegisterRoute(nameof(ReaderPage), typeof(ReaderPage));
//Routing.RegisterRoute(nameof(ProfilePage), typeof(ProfilePage));
//Routing.RegisterRoute("books/modalReader", typeof(ModalReader));
//Routing.RegisterRoute("books/searchPage", typeof(BooksSeachPage));
//Routing.RegisterRoute("books/reader/bookmarks", typeof(BookmarksModal));
//Routing.RegisterRoute("books/reader/font", typeof(FontModal));
}
builder.Services.AddTransient<SessionManagement>();
builder.Services.AddSingleton<MainPage>();
builder.Services.AddSingleton<Authenticator>();
builder.Services.AddSingleton<LoginPage>();
builder.Services.AddSingleton<BooksPage>();
//builder.Services.AddTransient<ReaderPage>();
//builder.Services.AddTransient<ProfilePage>();
//builder.Services.AddTransient<ModalReader>();
//builder.Services.AddTransient<BookmarksModal>();
//builder.Services.AddTransient<FontModal>();
You have already registered the route for BooksPage in the Shell visual hierarchy
<ShellContent
Title="წიგნები"
....
Route="BooksPage" />
So you don't have to register it again in code behind, just delete this,
Routing.RegisterRoute(nameof(BooksPage), typeof(BooksPage));
For more info, please refer to Routes