Understanding implicit vs explicit shell route registration #17628
Unanswered
hansmbakker
asked this question in
Q&A
Replies: 1 comment
-
One workaround would be to add a ShellItem with Route="LandingPage" to your AppShell.xaml. Then you can invoke |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an issue with route registration in MAUI
Shell
.First of all, it is possible to define routes on different places, having a different effect. This different result is super confusing.
AppShell.xaml
using theRoute
parameter ofShellItem
s. This results in an object inShell.Current.Children
having anRoute
property with valueIMPL_{value of Route parameter in AppShell.xaml}
. This is an implicit route according to the logic in Routing.cs. It does not show up inRouting.s_routes
.Routing.RegisterRoute(route, typeof(TView))
, or using something likeAddSingletonWithShellRoute
from MAUI Community Toolkit (which callsRouting.RegisterRoute(route, typeof(TView))
under the hood). This does result in a route registered inRouting.s_routes
. I guess you could call this an explicit route then, although it is not called as such in the code.Another, even more annoying part is that
Shell.Current.GoToAsync("///LoadingPage")
on it without a problemShell.Current.GoToAsync("///LoadingPage")
throws an exception:This means that you cannot use
Routing.RegisterRoute(route, typeof(TView))
nor theAddSingletonWithShellRoute
convenience function to register routes if you want to do an absolute navigation.Documentation for this item is missing, and from the code it is not intuitive what to expect with what approach
Beta Was this translation helpful? Give feedback.
All reactions