Clarify TabbedPage Shell incompatibility and modal usage
Users attempting to navigate to a TabbedPage from a Shell app using Routing.RegisterRoute and Shell.Current.GoToAsync get a "View Not found" error with no clear explanation why.
Changes
- Expanded the existing Shell incompatibility WARNING to explicitly mention:
-
Routing.RegisterRoutecannot register aTabbedPageas a route in the Shell visual hierarchy -
Shell.Current.GoToAsynccannot navigate to aTabbedPage -
TabbedPageCAN be used as a modal page in Shell apps usingNavigation.PushModalAsyncbecause modal pages exist in a separate navigation space
-
- Added links to:
- Shell tabs documentation as the recommended alternative for tab-based navigation in the Shell visual hierarchy
- Modal navigation documentation for displaying TabbedPage modally in Shell apps
Example of what doesn't work
// This fails - TabbedPage cannot be used with Shell navigation hierarchy
Routing.RegisterRoute("CustomTabPage", typeof(CustomTabPage)); // CustomTabPage : TabbedPage
await Shell.Current.GoToAsync(nameof(CustomTabPage)); // "View Not found"
Example of what DOES work
// This works - TabbedPage can be displayed as a modal
await Navigation.PushModalAsync(new CustomTabPage()); // CustomTabPage : TabbedPage
For Shell apps needing tabs as part of the visual hierarchy, use TabBar/Tab/ShellContent instead. For displaying a TabbedPage temporarily, use modal navigation.
Original prompt
This section details on the original issue you should resolve
<issue_title>Navigating Tabbed Page creating Issue</issue_title> <issue_description>### Type of issue
Code doesn't work
Description
I have created TabbedPage in MAUI ,
"<TabbedPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="FaizMobileApp6.CustomTabPage" Title="CustomTabPage">
<ContentPage Title="Tab 1"> <StackLayout> <Label Text="This is Tab 1" /> </StackLayout> </ContentPage> <ContentPage Title="Tab 2"> <StackLayout> <Label Text="This is Tab 2" /> </StackLayout> </ContentPage></TabbedPage>"
In AppShell.Xaml.Cs registered Rout
Routing.RegisterRoute("CustomTabPage", typeof(CustomTabPage));
On MainPage.Xaml.cs I am calling TabbedPage as private async void OnProceedClicked(object sender, EventArgs e) {
await Shell.Current.GoToAsync(nameof(CustomTabPage));}
I am getting error as "View Not found"
Will someone help in this regards
If calling with Navigation.PushModalAsync(new NavigationPage( ...).. The Back Button is not visible in TabbedPage [Enter feedback here]
Page URL
https://learn.microsoft.com/en-us/dotnet/maui/user-interface/pages/tabbedpage?view=net-maui-8.0
Content source URL
https://github.com/dotnet/docs-maui/blob/main/docs/user-interface/pages/tabbedpage.md
Document Version Independent Id
d9f1977c-bc41-c096-0b17-6db418d440b0
Article author
@davidbritch
Metadata
- ID: d9f1977c-bc41-c096-0b17-6db418d440b0
- Service: dotnet-mobile
- Sub-service: dotnet-maui</issue_description>
Comments on the Issue (you are @copilot in this section)
- Fixes dotnet/docs-maui#2389
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Internal previews
| 📄 File | 🔗 Preview link |
|---|---|
| docs/user-interface/pages/tabbedpage.md | docs/user-interface/pages/tabbedpage |