What is missing?
When a Page A navigates to Page B, Page B may determine in its InitializeAsync method, that the navigation is incorrect and should be cancelled.
This is currently not possible.
How should this be implemented
The easies option is to let Page B call INavigator.BackAsync.
Should a navigation still be "in progress", that flow should be cancelled.
In our example, Page A's navigation to Page B is still in progress when Page B calls INavigator.BackAsync in it's InitializeAsync method.
In that case, the INavigator should simply navigate back to Page A
Why is this feature important?
- Conditional Navigation: Pages can decide at runtime whether
they should be displayed based on user permissions, data
availability, or other conditions
- User Experience: Prevents users from seeing pages that should
be redirected or cancelled
- Navigation Chains: Supports complex navigation flows where
pages navigate to other pages that might cancel the entire
chain