From d6a363ded9503f2e692af22c9ebd4d7a1445eb3c Mon Sep 17 00:00:00 2001 From: Pedro Jesus Date: Mon, 27 Oct 2025 23:45:43 -0300 Subject: [PATCH 1/7] remove navBar --- src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs b/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs index fc00b1ae89..235feb699b 100644 --- a/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs +++ b/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs @@ -1,9 +1,7 @@ using System.ComponentModel; using System.Globalization; -using System.Windows.Input; using CommunityToolkit.Maui.Converters; using CommunityToolkit.Maui.Core; -using CommunityToolkit.Maui.Extensions; using Microsoft.Maui.Controls.PlatformConfiguration; using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; using Microsoft.Maui.Controls.Shapes; @@ -66,6 +64,7 @@ public PopupPage(Popup popup, IPopupOptions? popupOptions) Shell.SetPresentationMode(this, PresentationMode.ModalNotAnimated); On().SetModalPresentationStyle(UIModalPresentationStyle.OverFullScreen); + Microsoft.Maui.Controls.NavigationPage.SetHasNavigationBar(this, false); } public event EventHandler? PopupClosed; @@ -85,7 +84,8 @@ public async Task CloseAsync(PopupResult result, CancellationToken token = defau if (popupPageToClose is null) { - throw new PopupNotFoundException(); + await Navigation.PopModalAsync(); + return; } if (Navigation.ModalStack[^1] is Microsoft.Maui.Controls.Page currentVisibleModalPage From d70a248b98a504328d27b73c2297f3582b5d5ad5 Mon Sep 17 00:00:00 2001 From: Pedro Jesus Date: Tue, 28 Oct 2025 00:12:17 -0300 Subject: [PATCH 2/7] fix navigation --- .../Views/Popup/PopupPage.shared.cs | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs b/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs index 235feb699b..0adc361161 100644 --- a/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs +++ b/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs @@ -5,6 +5,8 @@ using Microsoft.Maui.Controls.PlatformConfiguration; using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; using Microsoft.Maui.Controls.Shapes; +using NavigationPage = Microsoft.Maui.Controls.NavigationPage; +using Page = Microsoft.Maui.Controls.Page; namespace CommunityToolkit.Maui.Views; @@ -64,7 +66,7 @@ public PopupPage(Popup popup, IPopupOptions? popupOptions) Shell.SetPresentationMode(this, PresentationMode.ModalNotAnimated); On().SetModalPresentationStyle(UIModalPresentationStyle.OverFullScreen); - Microsoft.Maui.Controls.NavigationPage.SetHasNavigationBar(this, false); + NavigationPage.SetHasNavigationBar(this, false); } public event EventHandler? PopupClosed; @@ -84,7 +86,7 @@ public async Task CloseAsync(PopupResult result, CancellationToken token = defau if (popupPageToClose is null) { - await Navigation.PopModalAsync(); + await FindPopupPage(); return; } @@ -213,6 +215,32 @@ void HandleTapGestureRecognizerTapped(object? sender, TappedEventArgs e) } } + Task FindPopupPage() + { + var stack = Navigation.ModalStack; + + if (stack.Count is 0) + { + throw new PopupNotFoundException(); + } + + var page = stack[^1]; + + switch (page) + { + case IPageContainer container: + if (container.CurrentPage is not PopupPage) + { + throw new PopupNotFoundException(); + } + break; + case not PopupPage: + throw new PopupNotFoundException(); + } + + return Navigation.PopModalAsync(false); + } + internal sealed partial class PopupPageLayout : Grid { public PopupPageLayout(in Popup popupContent, in IPopupOptions options) From c72fd41edd2d48d92aa59608098015f094dfa64f Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+TheCodeTraveler@users.noreply.github.com> Date: Wed, 5 Nov 2025 15:05:42 -0800 Subject: [PATCH 3/7] Add Sample --- .../Pages/Views/Popup/PopupsPage.xaml | 2 ++ .../Pages/Views/Popup/PopupsPage.xaml.cs | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/Popup/PopupsPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Views/Popup/PopupsPage.xaml index 82ca4cb591..46d0348745 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/Popup/PopupsPage.xaml +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/Popup/PopupsPage.xaml @@ -35,6 +35,8 @@