Sérgio Damasceno
Sérgio Damasceno

Reputation: 731

Xamarin Forms/Prism 8 - TabbedPage with NavigationPage navigation not working properly

A solution that worked before Prism 8, is not working as expected. On the GitHub sample has a simple solution that shows the problem.

The Xamarin Forms app has a MainPage(TabbedPage) with 3 tabs. On each tab there´s a NavigationPage.

<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:views="clr-namespace:SuperBarato.Views"
            x:Class="SuperBarato.Views.MainPage">

    <TabbedPage.Children>
        <NavigationPage Title="Promoções"
                        IconImageSource="tag.png">
            <x:Arguments>
                <views:PromotionsPage/>
            </x:Arguments>
        </NavigationPage>

        <NavigationPage Title="Nova"
                        IconImageSource="signs.png">
            <x:Arguments>
                <views:NewPromotionPage/>
            </x:Arguments>
        </NavigationPage>

        <NavigationPage Title="Conta"
                        IconImageSource="user.png">
            <x:Arguments>
                <views:AccountPage/>
            </x:Arguments>
        </NavigationPage>
    </TabbedPage.Children>
</TabbedPage>

On 2nd tab, there's a button that calls for MarketsPage. But MarketsPage is not been added on the 2nd tab NavigationPage stack. It's been added on the 3rd tab NavigationPage stack.

I tried to create the tabs at runtime as Prism documentation says (App.xaml.cs). That resolved the problem. But, it makes appear other problems.

Some commands that I used to navigate through pages are not working. I can't clear the stack of a NavigationPage that's inside a tab of a TabbedPage.

await _navigationService.NavigateAsync("/SignInPage")

await _navigationService.NavigateAsync("../SignInPage")

Does anyone know how to work with Xamarin Forms TabbedPages with NavigationPages on Prism 8?

GitHub sample: https://github.com/Schinwinkwinsky/XFPrismTabPagesNabPages

Upvotes: 2

Views: 1327

Answers (1)

S&#233;rgio Damasceno
S&#233;rgio Damasceno

Reputation: 731

There was an Issue on Prism GitHub that it was treating about this. Brian Laguna has finished (and explained) saying:

Brian Laguna says

That's the man!

https://github.com/PrismLibrary/Prism/issues/2279#issuecomment-746959294

Upvotes: 1

Related Questions