diff --git a/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs b/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs index 97c0f0293d..e2acaf4818 100644 --- a/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs +++ b/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs @@ -403,7 +403,7 @@ protected virtual async Task ProcessNavigation(Page currentPage, Queue s var nextSegment = segments.Dequeue(); - var pageParameters = UriParsingHelper.GetSegmentParameters(nextSegment); + var pageParameters = UriParsingHelper.GetSegmentParameters(nextSegment, parameters); if (pageParameters.TryGetValue(KnownNavigationParameters.UseModalNavigation, out var parameterModal)) useModalNavigation = parameterModal; @@ -604,7 +604,7 @@ await DoNavigateAction(topPage, nextSegment, topPage, parameters, onNavigationAc { if (nextSegment.Contains(KnownNavigationParameters.SelectedTab)) { - var segmentParams = UriParsingHelper.GetSegmentParameters(nextSegment); + var segmentParams = UriParsingHelper.GetSegmentParameters(nextSegment, parameters); SelectPageTab(topPage, segmentParams); } }); @@ -706,7 +706,7 @@ await DoNavigateAction(null, nextSegment, detail, parameters, onNavigationAction { if (detail is TabbedPage && nextSegment.Contains(KnownNavigationParameters.SelectedTab)) { - var segmentParams = UriParsingHelper.GetSegmentParameters(nextSegment); + var segmentParams = UriParsingHelper.GetSegmentParameters(nextSegment, parameters); SelectPageTab(detail, segmentParams); } @@ -891,7 +891,7 @@ protected virtual Page CreatePageFromSegment(string segment) async Task ConfigureTabbedPage(TabbedPage tabbedPage, string segment, INavigationParameters parameters) { - var tabParameters = UriParsingHelper.GetSegmentParameters(segment); + var tabParameters = UriParsingHelper.GetSegmentParameters(segment, parameters); var tabsToCreate = tabParameters.GetValues(KnownNavigationParameters.CreateTab); foreach (var tabToCreateEncoded in tabsToCreate ?? Array.Empty()) @@ -1029,7 +1029,7 @@ protected virtual async Task UseReverseNavigation(Page currentPage, string nextS } //if any page decide to go modal, we need to consider it and all pages after it an illegal page - var pageParameters = UriParsingHelper.GetSegmentParameters(item); + var pageParameters = UriParsingHelper.GetSegmentParameters(item, parameters); if (pageParameters.ContainsKey(KnownNavigationParameters.UseModalNavigation)) { if (pageParameters.GetValue(KnownNavigationParameters.UseModalNavigation)) diff --git a/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Navigation/NavigationTests.cs b/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Navigation/NavigationTests.cs index 7ff873c66e..c7e4d2aa94 100644 --- a/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Navigation/NavigationTests.cs +++ b/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Navigation/NavigationTests.cs @@ -548,6 +548,29 @@ public async Task PushesModally(string startUri, string requestUri, bool? expect Assert.True(PageNavigationService.UseModalNavigation(push.CurrentPage, useModalNavigation)); } + [Fact] + public async Task PushesModally_From_NavigationParameters() + { + var mauiApp = CreateBuilder(prism => prism + .CreateWindow(n => n.NavigateAsync("NavigationPage/MockViewA"))) + .Build(); + var window = GetWindow(mauiApp); + var page = window.Page; + if (page is NavigationPage navPage) + page = navPage.RootPage; + + var navService = Prism.Navigation.Xaml.Navigation.GetNavigationService(page); + + var result = await navService.NavigateAsync("MockViewB", new NavigationParameters { { KnownNavigationParameters.UseModalNavigation, true } }); + Assert.True(result.Success); + + var pushes = navService.GetPushes(); + Assert.Single(pushes); + var push = pushes[0]; + + Assert.True(push.UseModalNavigation); + } + private static void TestPage(Page page) { Assert.NotNull(page.BindingContext);