docs-maui
docs-maui copied to clipboard
Context seems to be missing
While reading this page and seeing the examples it is hard to understand the context of the examples. It will say "A page can be modally navigated to by calling the PushModalAsync method on the Navigation property of the current page:" then shows a code example and explains what that code did.
But the constructor of a page is not asynchronous and cannot await methods. So that leaves me unsure as to where this code goes. If the example showed the class with this code in it then I would understand how to use it.
Also it speaks to the "Navigation Property" of the current page. Does each page I create have a navigation property or do I need to add one.
I feel like there is another document I should have read before reading this one but can't find it referenced here.
I was able to understand the root page example as it shows the app class cs file and where the code would go.
I'm certain the explanation is spot on I just don't understand the context so i'm confused.
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
- ID: 2de983b4-92d4-6429-ff72-1b86fde88687
- Version Independent ID: 2de983b4-92d4-6429-ff72-1b86fde88687
- Content: NavigationPage - .NET MAUI
- Content Source: docs/user-interface/pages/navigationpage.md
- Product: dotnet-mobile
- Technology: dotnet-maui
- GitHub Login: @davidbritch
- Microsoft Alias: dabritch
Hi @adventiar
Fair comments and I'll give the doc an update. In the meantime, answers to your questions:
But the constructor of a page is not asynchronous and cannot await methods. So that leaves me unsure as to where this code goes.
Page navigation code would typically go in an asynchronous event handler (e.g. for a button click), or an async override on the page (such as OnAppearing).
Also it speaks to the "Navigation Property" of the current page. Does each page I create have a navigation property or do I need to add one.
Each page has a Navigation property.