Home > database >  How can you make a tabs on a specific page in .NET MAUI?
How can you make a tabs on a specific page in .NET MAUI?

Time:10-25

I want to make tabs for a specific page, but with AppShell I can just do this for everypage. I just want tabs only in one page, and not the others.

CodePudding user response:

If you want to have your Tabpage after the first page, you just have to navigate to the AppShell that contains the Tabpage. For example, in an app that has a LoginPage and next the Tabpage, you can do it like this.

App.xaml.cs:

App.Current.MainPage = LoginPage;

AppShell.xaml

<ShellContent
    Title="Home"
    ContentTemplate="{DataTemplate vm:HomePage}"
    />

And then, just navigate to HomePage (Tabpage) using Shell navigation.

App.Current.MainPage = new AppShell();

CodePudding user response:

You can set the MainPage as NavigationPage and then navigate to the specific Tabbedpage.

App.xaml.cs

public partial class App : Application
{
    public App()
    {
        InitializeComponent();
        MainPage = new NavigationPage(new MainPage());
    }
}

In your MainPage, you can navigate to the specific Tabbedpage` like below:

await Navigation.PushAsync(new MyTabbedPage());
  • Related