dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.28k stars 1.76k forks source link

OnNavigatedFrom is not triggered as expected from FlyoutPage.Detail #25682

Open Croppo opened 3 weeks ago

Croppo commented 3 weeks ago

Description

In our app we use FlyoutPage to separate the apps content on tablets. We have the FlyoutLayoutBehavior set to Split.

This gives a persistent menu that allows the majority of the operations within the app to be done through the detail pane. This is where the majority of our navigation lies.

The issue we are currently facing is when a modal is opened from the detail pane the OnNavigatedFrom method is not called from the detail itself. Rather it is triggered on the FlyoutPage.

Is this expected behavior? If so, what is the recommended way around this?

Re: similarity score: This was posted on wrong account initially. Have since closed on initial posting and shifted to re-posting on this one.

Link to public reproduction project repository

FlyoutPageMauiSample

Steps to reproduce

On the home screen click the "navigate to modal" button in the detail pane.

Expected outcome: A dialog should be raised stating, "Navigated from detail page".

Actual Outcome: No dialog is raised as the OnNavigatedFrom method is firing on MainPage.xaml.cs rather than DetailPage.xaml.cs

Demo_ Video

Affected Platforms

Android, iOS

similar-issues-ai[bot] commented 3 weeks ago

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

mattleibow commented 2 weeks ago

@PureWeen will showing a modal page trigger the navigation from? The page is still technically there...

@Croppo if you navigate via a normal/non-modal page, does the event fire?

Croppo commented 2 weeks ago

@mattleibow When navigating the event will fire, however, it will be on the flyout page instead of the detail within the flyout page.

In our app we have navigation implemented in the detail of the flyout page and all of the normal pages fire the event correctly it is only when a modal is pushed that is calls the event directly on the flyout page.

If you use the demo app in the linked repo you will see the behavior discussed :)