How to initialize the same page twice with parameters and use as tabs in Xamarin Forms with Prism?

IntelnegoIntelnego ✭✭USUniversity ✭✭

So, I have a tabbed page called ViewA and I have a content page called ViewB. I need to create two instances of my ViewB as tabs on my ViewA. The thing is that ViewB receives parameters and the initialization differs based on the parameters. In simple Xamarin Forms I can just do something like this in the Child of ViewA:

<local:ViewB>
    <x:Arguments>
         <x:String>17</x:String>
    </x:Arguments>
</local:ViewB>

With that I could use the codebehind of my ViewB to initialize each instance based on the parameters. But what I really want is to use MVVM and Prism to achieve the same result. I want to be able to construct my two instances of my ViewB with different parameters and put them inside ViewA.

I saw this sample https://github.com/PrismLibrary/Prism-Samples-Forms/tree/master/TabbedNavigation but I wasn't convinced with use of codebehind combined with MVVM.

Is there a way to do this only with Prism (Mvvm) without codebehind? or am I wrong to avoid this combination?

Thanks in advance,
Greetings and Blessings.

Sign In or Register to comment.