Net Maui Shell How to back button command for multi pages ?
Sami
856
Reputation points
I have multi pages on shell navigation like this
await Shell.Current.GoToAsync("/aaa");
await Shell.Current.GoToAsync("/bbb");
await Shell.Current.GoToAsync("/ccc");
await Shell.Current.GoToAsync("/ddd");
Public AppShell()
{
InitializeComponent();
BindingContext = this;
Routing.RegisterRoute("aaa", typeof(APage));
Routing.RegisterRoute("bbb", typeof(BPage));
Routing.RegisterRoute("ccc", typeof(CPage));
Routing.RegisterRoute("ddd", typeof(DPage));
}
then on viewmodel I have created global back command like this
public ICommand BackCommand { get; } = new Command(async () => await Shell.Current.GoToAsync(".."));
first page is going back as expected but the other pages is not working how to do that ?