2
votes

I have an app which has many pages and navigation is enabled between modal and non-modal pages . But somehow whenever I'm trying to set useModalNavigation property as false, it doesn't seem to work. Modal type navigation is suppressing the actual page navigation. Now my app has navigation between modals and root page. Any way out?

My app.xaml.cs has

await NavigationService.NavigateAsync(new Uri($"https://NavigationPage/{nameof(MyMainPage)}", UriKind.Absolute));

In MyMainPage I have a button which is further opening a content page. For this, i have a delegate command which is making below call to navigate to inner page on button click: navigationService.NavigateAsync("MyInnerPage", useModalNavigation:false);

1
It's unclear what exactly you're trying to do. Are you trying to navigate from a modal page to a non-modal page? - Dennis Schröer
@DennisSchröer Yes. I have one contentpage and contentview - Shruti Dutt
You sure this is not working? Because I have an example that will open modal or non modal views and within those again modal or non modals. All working fine... look at github.com/Depechie/PRISMNavigation/blob/master/… and github.com/Depechie/PRISMNavigation/blob/master/… - Depechie
@Depechie Thanks for the response. But when I'm not using useModalNavigation as false, it doesn't seem to work for me. Somehow, I'm observing a different pattern while using simple page navigation. I have a button which opens a content page, and I'm seeing a modal navigation type navigation not page navigation on display. - Shruti Dutt
Hmm only thing I can suggest is double check the implementation code and see if you see why the modal flag can be set to true ( when not given ) github.com/PrismLibrary/Prism/blob/… - Depechie

1 Answers

1
votes

According to the Xamarin docs, not being able to navigate away from a modal page is expected behavior:

A modal page encourages users to complete a self-contained task that cannot be navigated away from until the task is completed or cancelled.

You need to pop the modal page to be able to navigate again:

await Navigation.PopModalAsync();

If you want to navigate away from this page, don't use modal navigation.