0

How do you navigate from a modal popup?

I've opened a modal page using await NavigationService.PushModalAsync() which I'm using as a login page. With a successful login, I'm trying to close the modal and navigate to an account page.

await NavigationService.PopModalAsync();

await NavigationService.PushAsync();

The modal closes, but it will not show the page specified in the PushAsync Method. Both lines of code run, no errors thrown. The page the pushasync() goes to, displays fine if the login modal window is skipped.

The above code is in a [RelayCommand] method using community toolkit mvvm

What do I need to do to get the above to work?

3
  • Unclear what it could be. Maybe make a public github repo with just enough code to make the problem happen. Commented Sep 12, 2022 at 15:05
  • Could you provide some code related? Commented Sep 14, 2022 at 9:44
  • The code is above. just open(pushmodalasync) a modal page, then try close (popmodalasync) the modal and navigate (pushasync) to another page. The navigate never happens, but no errors. I unfortunately dont have the time currently to create a working sample project on github to show those 3 lines of code. Commented Sep 15, 2022 at 10:40

1 Answer 1

1

enter image description here

Unfortunately your needs cannot be achieved. As mentioned in the figure above, the login page you created is a modal page, therefore it can navigate only to another modal page. When you call PopModalAsync, the login page pops up from ModalStack directly, meanwhile the (moldeless) page at the top of the NavigationStack will appear. And you call PushAsync to navigate to the account page in modal page, it doesn't work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.