Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

back button not working in Shell navigation Xamarin MAUI in multiple layer navigation

When I try to navigate into multiple-layer navigation, the back button not working.

Let's say first goes into the "dashboard" page then I go into the "animals" page then if I try the back button it's working fine, but if I go deeper into the "cats" page and then try the back button it not working. I check both windows and android devices.

1.<ShellContent Title="Home" ContentTemplate="{DataTemplate page:DashBoard}" Route="DashBoard" />

2.await Shell.Current.GoToAsync("animals");

3.await Shell.Current.GoToAsync("cats");

am I missing something here, please help me out.

like image 926
Sourav Paria Avatar asked Oct 19 '25 15:10

Sourav Paria


1 Answers

Okay, I figure out what was the problem, it was this -

<ShellContent Title="Home" ContentTemplate="{DataTemplate page:DashBoard}" Route="DashBoard" />

but it needs to be like this -

<ShellContent Title="Home" ContentTemplate="{DataTemplate page:DashBoard}" />

so the main problem is that I declared Route="DashBoard" in Xaml also I'm Registering in cs like this - Routing.RegisterRoute(nameof(DashBoard), typeof(DashBoard)) which creates ambiguity.

like image 111
Sourav Paria Avatar answered Oct 22 '25 05:10

Sourav Paria



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!