From bc4164ae462c6c8f7c2ec0835eebceb3444ba588 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 28 Nov 2025 23:06:20 +0000 Subject: [PATCH 1/2] Initial plan From 0f34db263f4a665b64d80edecaf51cb5426c10f6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 28 Nov 2025 23:10:52 +0000 Subject: [PATCH 2/2] Add contextual examples to NavigationPage documentation - Updated navigation code examples to show them within button click event handlers - Added explanation that Navigation property is available on any Page-derived type - Provides clearer context for where navigation code should be placed - Updated ms.date to reflect the changes Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com> --- docs/user-interface/pages/navigationpage.md | 24 +++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/docs/user-interface/pages/navigationpage.md b/docs/user-interface/pages/navigationpage.md index 99c533518..be31fb196 100644 --- a/docs/user-interface/pages/navigationpage.md +++ b/docs/user-interface/pages/navigationpage.md @@ -1,7 +1,7 @@ --- title: "NavigationPage" description: "The .NET MAUI NavigationPage is used to perform hierarchical navigation through a stack of last-in, first-out (LIFO) pages." -ms.date: 09/30/2024 +ms.date: 11/28/2025 --- # NavigationPage @@ -105,10 +105,13 @@ public partial class App : Application ### Push pages to the navigation stack -A page can be navigated to by calling the `PushAsync` method on the `Navigation` property of the current page: +A page can be navigated to by calling the `PushAsync` method on the `Navigation` property of the current page. The `Navigation` property is available on any -derived type. The following example shows a button click event handler in a page's code-behind file that navigates to `DetailsPage`: ```csharp -await Navigation.PushAsync(new DetailsPage()); +async void OnNavigateButtonClicked(object sender, EventArgs e) +{ + await Navigation.PushAsync(new DetailsPage()); +} ``` In this example, the `DetailsPage` object is pushed onto the navigation stack, where it becomes the active page. @@ -123,7 +126,10 @@ The active page can be popped from the navigation stack by pressing the *Back* b To programmatically return to the previous page, the `PopAsync` method should be called on the `Navigation` property of the current page: ```csharp -await Navigation.PopAsync(); +async void OnBackButtonClicked(object sender, EventArgs e) +{ + await Navigation.PopAsync(); +} ``` In this example, the current page is removed from the navigation stack, with the new topmost page becoming the active page. @@ -169,7 +175,10 @@ Modal navigation methods are exposed by the `Navigation` property on any