1

What is the best way to navigate from a tab page 1 to another tab page 2?

The scenario is that I when I press a button in a tab page, it should navigate to another tab page. I can't set the main tab page's selected tab property because I'm in the tab page 1 viewmodel.

Here is my code, this isn't working but is what I intend to do.

NavigationService.NavigateAsync($"{KnownNavigationParameters.SelectedTab}=TabPage2");

The working code is this, but the problem is that it reloads everything since it navigates to another instance of the MainTabbedPage then selects the TabPage2 tab.

NavigationService.NavigateAsync($"MainTabbedPage?{KnownNavigationParameters.SelectedTab}=TabPage2");
iamlawrencev
  • 148
  • 2
  • 11

1 Answers1

0

If you want to navigate to tab use the following code, I am using this for navigating from a drawer and it works fine hope it will work for you.

var navParams = new NavigationParameters
{
    { "Title", "Page Title" }
};
NavigationService.NavigateAsync("NavigationPage/{Tab Parent Page}/" + {Tab Page}, navParams );
K K
  • 952
  • 9
  • 25