2
votes

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

1
Yes, I tried a lot of things and I discovered that when the tabs are declared on TabbedPage XAML, Prism doesn't connect the View to its respective ViewModel. It worked on the last version of Prism (7.2.0.1422), but not with 8 version.Sérgio Damasceno

1 Answers

1
votes

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