| ContentPage-vs-Page | AppShell-vs-MainPage | |
TabBar vs Shell Tab in .NET MAUI |
Understanding how tabs work in Xamarin.Forms / .NET MAUI Shell
TabBar is a container that holds multiple tabs. It is part of the Shell navigation hierarchy and defines the primary sections of your app.
Example:
<Shell>
<TabBar>
<ShellContent Title="Home" ContentTemplate="{DataTemplate local:HomePage}" />
<ShellContent Title="Settings" ContentTemplate="{DataTemplate local:SettingsPage}" />
</TabBar>
</Shell>
A Shell Tab (<Tab>) represents one section inside the TabBar. A tab can host one or more ShellContent pages and supports hierarchical navigation within that tab.
Example:
<TabBar>
<Tab Title="Home">
<ShellContent ContentTemplate="{DataTemplate local:HomePage}" />
<ShellContent ContentTemplate="{DataTemplate local:DetailsPage}" />
</Tab>
<Tab Title="Profile">
<ShellContent ContentTemplate="{DataTemplate local:ProfilePage}" />
</Tab>
</TabBar>
Shell
└── TabBar
├── Tab "Home"
│ ├── ShellContent → HomePage
│ └── ShellContent → DetailsPage
└── Tab "Profile"
└── ShellContent → ProfilePage
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MyApp">
<TabBar>
<Tab Title="Home" Icon="home.png">
<ShellContent Route="home" Title="Home"
ContentTemplate="{DataTemplate local:HomePage}" />
<ShellContent Route="details" Title="Details"
ContentTemplate="{DataTemplate local:DetailsPage}" />
</Tab>
<Tab Title="Profile" Icon="user.png">
<ShellContent Route="profile" Title="Profile"
ContentTemplate="{DataTemplate local:ProfilePage}" />
</Tab>
</TabBar>
</Shell>
| ContentPage-vs-Page | AppShell-vs-MainPage | |