Is it possible to do wizard-style navigation with Xamarin Shell?

EasyGoingPat 261 Reputation points
2021-04-22T09:03:14.243+00:00

My application architecture is a natural fit for a wizard-style. In other words, I want to explicitly lead users from one screen to the next. Usually they can go back but sometimes even this doesn't make sense and they need to be held on the current screen until something happens (i.e. the screen is modal, with no back button).

I can build the structure of this using Xamarin Shell but I need to get rid of the flyout menu and the tab bar. And sometimes I need to make sure there is no back button.

I was using the old Xamarin navigation hierarchy, with PushAsync(), PopAsync(), PopToRootAsync(), etc. This was mostly working but the problem of having separate navigation stacks for modal and non-modal pages seems to make it unworkable.

The specific problem is that when popping a modal page, no event occurs back in the parent page. Also, there appears to be no way to pop back to the root from a modal page.

Is wizard-style navigation possible in Xamarin Shell?

Any advice or pointers to information would be welcome.

Kind wishes - Patrick

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,294 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JarvanZhang 23,936 Reputation points
    2021-04-22T12:20:02.657+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    I can build the structure of this using Xamarin Shell but I need to get rid of the flyout menu and the tab bar. And sometimes I need to make sure there is no back button.

    Do you want to achieve this for a page that is going to navigate to? Just use the navigation method and the new page will not contains the flyout menu or tabbar. Modal page doesn't show the back button.

       private async void Button_Clicked(object sender, EventArgs e)  
       {  
           Navigation.PushModalAsync(new TestPage());  
       }  
    

    The specific problem is that when popping a modal page, no event occurs back in the parent page. Also, there appears to be no way to pop back to the root from a modal page.

    Try to detect the OnAppearing method of the parent page, the method will be called when the page is shown on the screen. To back to the root page, you could reset the MainPage.

       App.Current.MainPage = new AppShell();  
    

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.