I have a very simple navigation stack consisting of a root page and then a model page on top of it. My root page is being set as the root by being the first page to be registered with Shell.
public AppShell()
{
InitializeComponent();
// opening view
Regester<LoginPage>();
Regester<SignUpPage>();
...
}
private void Regester<T>()
{
System.Diagnostics.Debug.WriteLine($"Regestering with shell : {typeof(T).Name} - {typeof(T)}");
Items.Add(new ShellContent { Route = typeof(T).Name, ContentTemplate = new DataTemplate(typeof(T)) });
Routing.RegisterRoute(typeof(T).Name, typeof(T));
}
}
Then I am navigating to the model sign up page using relative routing
Shell.Current.GoToAsync("SignUpPage");
or I will use absolute routing
Shell.Current.GoToAsync("///LogInPage/SignUpPage");
then I will attempt to navigate back in the stack using
Shell.Current.GoToAsync("..");
But I get this exception
Global routes currently cannot be the only page on the stack, so absolute routing to global routes is not supported. For now, just navigate to: LoginPage/
At the time of exception the CurrentState.Location property is this
Location = {///LoginPage/SignUpPage}
I don't understand why this is happening. This will also happen if I am further into the stack and doing something like trying to navigate back from a detail page. What do I need to do to be able to use GoToAsync("..") properly?