[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D1VY1RTSPXVX91YRRCA5WF":3,"skill-same:01M7D1VY1RTSPXVX91YRRCA5WF":50},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7D1VY1RTSPXVX91YRRCA5WF","maui-shell-navigation",null,"Guide for implementing Shell-based navigation in .NET MAUI apps. Covers AppShell setup, visual hierarchy (FlyoutItem, TabBar, Tab, ShellContent), URI-based navigation with GoToAsync, route registration, query parameters, back navigation, flyout and tab configuration, navigation events, and navigation guards. Use when: setting up Shell navigation, adding tabs or flyout menus, navigating between pages with GoToAsync, passing parameters between pages, registering routes, customizing back button behavior, or guarding navigation with confirmation dialogs. Do not use for: deep linking from external URLs (see .NET MAUI deep linking documentation), data binding on pages (use maui-data-binding), dependency injection setup (use maui-dependency-injection), or NavigationPage-only apps that don't use Shell.","itsmejay18\u002FAI-Skills-for-My-Development-Stack","itsmejay18","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F167779943?v=4","01M7CZRFC6DDZA5V2CX8WDSZED","Jay Jemino Ababon ","01M7CZRFCVRNW1SFHSQXEJ3CQN",0,"MIT","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F10-Mobile-Development\u002Fmaui-shell-navigation\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: maui-shell-navigation\ndescription: >-\n  Guide for implementing Shell-based navigation in .NET MAUI apps. Covers AppShell\n  setup, visual hierarchy (FlyoutItem, TabBar, Tab, ShellContent), URI-based navigation\n  with GoToAsync, route registration, query parameters, back navigation, flyout and\n  tab configuration, navigation events, and navigation guards.\n  Use when: setting up Shell navigation, adding tabs or flyout menus, navigating between\n  pages with GoToAsync, passing parameters between pages, registering routes, customizing\n  back button behavior, or guarding navigation with confirmation dialogs.\n  Do not use for: deep linking from external URLs (see .NET MAUI deep linking\n  documentation), data binding on pages (use maui-data-binding), dependency injection\n  setup (use maui-dependency-injection), or NavigationPage-only apps that don't use Shell.\nlicense: MIT\n---\n\n# .NET MAUI Shell Navigation\n\nImplement page navigation in .NET MAUI apps using Shell. Shell provides URI-based navigation, a flyout menu, tab bars, and a four-level visual hierarchy — all configured declaratively in XAML.\n\n## When to Use\n\n- Setting up top-level app navigation with tabs or a flyout menu\n- Navigating between pages programmatically with `GoToAsync`\n- Passing data between pages via query parameters or object parameters\n- Registering detail-page routes for push navigation\n- Guarding navigation with confirmation dialogs (e.g., unsaved changes)\n- Customizing back button behavior per page\n\n## When Not to Use\n\n- Deep linking from external URLs or app links — see [.NET MAUI deep linking docs](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Ffundamentals\u002Fapp-links)\n- Data binding on navigation target pages — use `maui-data-binding`\n- Dependency injection for pages and view models — use `maui-dependency-injection`\n- Apps using `NavigationPage` without Shell (different navigation API)\n\n## Inputs\n\n- A .NET MAUI project with `AppShell.xaml` as the root shell\n- Pages (`ContentPage`) to navigate between\n- Route names for detail pages not in the visual hierarchy\n\n## Rules That Change the Answer\n\nThese are the Shell-specific decisions that are easy to get wrong. Apply them\nwhenever they are relevant to what the user asked.\n\n| Situation | Do this | Not this |\n|---|---|---|\n| Declaring pages in `AppShell.xaml` | With `xmlns:views=\"clr-namespace:MyApp.Views\"` declared: `\u003CShellContent ContentTemplate=\"{DataTemplate views:MyPage}\" \u002F>` — the page is created on first navigation | `\u003CShellContent>\u003Cviews:MyPage \u002F>\u003C\u002FShellContent>`, which constructs **every** page at startup |\n| Navigating to a page not in the visual hierarchy | `Routing.RegisterRoute(\"details\", typeof(DetailsPage))` first | Calling `GoToAsync(\"details\")` unregistered — it throws at runtime |\n| Receiving navigation parameters | Implement `IQueryAttributable` on the **ViewModel** | Implementing it on the Page, which splits state from the BindingContext |\n| Passing a whole object | `ShellNavigationQueryParameters` | Serialising the object into the query string |\n| Any `GoToAsync` call | `await` it | Fire-and-forget — exceptions are swallowed and navigation races |\n| Confirming before back navigation | `ShellNavigatingEventArgs.GetDeferral()` … `deferral.Complete()` | Blocking synchronously on the dialog task |\n| Detecting back navigation | Check `e.Source == ShellNavigationSource.Pop` | Assuming every navigation is a back action |\n\n**Do not** propose `NavigationPage` \u002F `PushAsync` solutions for a Shell app, and do\nnot restructure a working `AppShell` hierarchy unless the user asked.\n\n**Answer narrowly, but completely.** Staying on topic does not mean being terse. When\nyou show a navigation change, include the pieces needed to run it: the `AppShell.xaml`\nmarkup *and* the `Routing.RegisterRoute` call, or the `GoToAsync` call *and* the\nreceiving `IQueryAttributable` \u002F `[QueryProperty]` code. Where two approaches are both\nvalid (query string vs `ShellNavigationQueryParameters`), show both and say when each\nfits — a single snippet the user still has to complete is a worse answer.\n\n## Shell Visual Hierarchy\n\nShell uses a four-level hierarchy. Each level wraps the one below it:\n\n```\nShell\n ├── FlyoutItem \u002F TabBar          (top-level grouping)\n │    ├── Tab                     (bottom-tab grouping)\n │    │    ├── ShellContent        (page slot → ContentPage)\n │    │    └── ShellContent        (multiple = top tabs)\n │    └── Tab\n └── FlyoutItem \u002F TabBar\n```\n\n- **FlyoutItem** — appears in the flyout menu; contains `Tab` children\n- **TabBar** — bottom tab bar with no flyout entry\n- **Tab** — groups `ShellContent`; multiple children produce top tabs\n- **ShellContent** — each points to a `ContentPage`\n\n### Implicit Conversion\n\nYou can omit intermediate wrappers. Shell auto-wraps:\n\n| You write                    | Shell creates                         |\n|------------------------------|---------------------------------------|\n| `ShellContent` only          | `FlyoutItem > Tab > ShellContent`     |\n| `Tab` only                   | `FlyoutItem > Tab`                    |\n| `ShellContent` in `TabBar`   | `TabBar > Tab > ShellContent`         |\n\n## Workflow: Set Up AppShell\n\n1. Define `AppShell.xaml` inheriting from `Shell`\n2. Add `FlyoutItem` or `TabBar` elements for top-level navigation\n3. Add `Tab` elements for bottom tabs; nest multiple `ShellContent` for top tabs\n4. **Always use `ContentTemplate`** with `DataTemplate` so pages load on demand\n5. **Give every `ShellContent` an explicit `Route`** (see below)\n6. Register detail-page routes in the `AppShell` constructor\n\n> **Set `Route=` on every `ShellContent`.** If you omit it, MAUI auto-generates a\n> name from a shared counter — `Routing.cs` produces `D_FAULT_{TypeName}{n}`. A real\n> shell with three unnamed `ShellContent` elements yields routes like\n> `D_FAULT_ShellContent2` and `D_FAULT_ShellContent5`: the numbers are not\n> sequential, they depend on how many Shell elements were constructed first, and they\n> shift when you reorder or add pages. You cannot write a stable absolute route\n> (`\u002F\u002Fdashboard`) or deep link against that. An explicit `Route=\"dashboard\"` is stable\n> forever.\n\n```xml\n\u003CShell xmlns=\"http:\u002F\u002Fschemas.microsoft.com\u002Fdotnet\u002F2021\u002Fmaui\"\n       xmlns:x=\"http:\u002F\u002Fschemas.microsoft.com\u002Fwinfx\u002F2009\u002Fxaml\"\n       xmlns:views=\"clr-namespace:MyApp.Views\"\n       x:Class=\"MyApp.AppShell\"\n       FlyoutBehavior=\"Flyout\">\n\n    \u003CFlyoutItem Title=\"Animals\" Icon=\"animals.png\">\n        \u003CTab Title=\"Cats\">\n            \u003CShellContent Title=\"Domestic\" Route=\"domesticcats\"\n                          ContentTemplate=\"{DataTemplate views:DomesticCatsPage}\" \u002F>\n            \u003CShellContent Title=\"Wild\" Route=\"wildcats\"\n                          ContentTemplate=\"{DataTemplate views:WildCatsPage}\" \u002F>\n        \u003C\u002FTab>\n        \u003CTab Title=\"Dogs\" Icon=\"dogs.png\">\n            \u003CShellContent Route=\"dogs\" ContentTemplate=\"{DataTemplate views:DogsPage}\" \u002F>\n        \u003C\u002FTab>\n    \u003C\u002FFlyoutItem>\n\n    \u003CTabBar>\n        \u003CShellContent Title=\"Home\" Icon=\"home.png\" Route=\"home\"\n                      ContentTemplate=\"{DataTemplate views:HomePage}\" \u002F>\n        \u003CShellContent Title=\"Settings\" Icon=\"settings.png\" Route=\"settings\"\n                      ContentTemplate=\"{DataTemplate views:SettingsPage}\" \u002F>\n    \u003C\u002FTabBar>\n\u003C\u002FShell>\n```\n\n```csharp\n\u002F\u002F AppShell.xaml.cs\npublic partial class AppShell : Shell\n{\n    public AppShell()\n    {\n        InitializeComponent();\n        Routing.RegisterRoute(\"animaldetails\", typeof(AnimalDetailsPage));\n        Routing.RegisterRoute(\"editanimal\", typeof(EditAnimalPage));\n    }\n}\n```\n\n## Workflow: Navigate with GoToAsync\n\nAll programmatic navigation uses `Shell.Current.GoToAsync`. Always `await` the call.\n\n### Route Prefixes\n\n| Prefix | Meaning                                     |\n|--------|---------------------------------------------|\n| `\u002F\u002F`   | Absolute route from Shell root              |\n| (none) | Relative; pushes onto the current nav stack |\n| `..`   | Go back one level                           |\n| `..\u002F`  | Go back then navigate forward               |\n\n### Navigation Examples\n\n```csharp\n\u002F\u002F 1. Absolute — switch to a specific hierarchy location\nawait Shell.Current.GoToAsync(\"\u002F\u002Fanimals\u002Fcats\u002Fdomestic\");\n\n\u002F\u002F 2. Relative — push a registered detail page\nawait Shell.Current.GoToAsync(\"animaldetails\");\n\n\u002F\u002F 3. With query string parameters\nawait Shell.Current.GoToAsync($\"animaldetails?id={animal.Id}\");\n\n\u002F\u002F 4. Go back one page\nawait Shell.Current.GoToAsync(\"..\");\n\n\u002F\u002F 5. Go back two pages\nawait Shell.Current.GoToAsync(\"..\u002F..\");\n\n\u002F\u002F 6. Go back one page, then push a different page\nawait Shell.Current.GoToAsync(\"..\u002Feditanimal\");\n```\n\n## Workflow: Pass Data Between Pages\n\n### Option 1: IQueryAttributable (Preferred)\n\nImplement on ViewModels to receive all parameters in one call:\n\n```csharp\npublic class AnimalDetailsViewModel : ObservableObject, IQueryAttributable\n{\n    public void ApplyQueryAttributes(IDictionary\u003Cstring, object> query)\n    {\n        if (query.TryGetValue(\"id\", out var id))\n            AnimalId = id.ToString();\n    }\n}\n```\n\n### Option 2: QueryProperty Attribute\n\nApply on the **ViewModel** class (or the page, if it genuinely owns the state).\nPrefer `IQueryAttributable` on the ViewModel — it keeps navigation state with the\n`BindingContext` and handles multiple parameters in one call:\n\n```csharp\n[QueryProperty(nameof(AnimalId), \"id\")]\npublic partial class AnimalDetailsViewModel : ObservableObject\n{\n    [ObservableProperty]\n    private string _animalId = string.Empty;\n}\n```\n\nShell applies query attributes *after* the page constructor sets `BindingContext`,\nso the property must raise change notification — a plain auto-property leaves the\nbinding stuck on its initial value.\n\n### Option 3: Complex Objects via ShellNavigationQueryParameters\n\nPass objects without serializing to strings:\n\n```csharp\nvar parameters = new ShellNavigationQueryParameters\n{\n    { \"animal\", selectedAnimal }\n};\nawait Shell.Current.GoToAsync(\"animaldetails\", parameters);\n```\n\nReceive via `IQueryAttributable`:\n\n```csharp\npublic void ApplyQueryAttributes(IDictionary\u003Cstring, object> query)\n{\n    Animal = query[\"animal\"] as Animal;\n}\n```\n\n## Workflow: Guard Navigation\n\nUse `GetDeferral()` in `OnNavigating` for async checks (e.g., \"save unsaved changes?\"):\n\n```csharp\n\u002F\u002F In AppShell.xaml.cs\nprotected override async void OnNavigating(ShellNavigatingEventArgs args)\n{\n    base.OnNavigating(args);\n    if (hasUnsavedChanges && args.Source == ShellNavigationSource.Pop)\n    {\n        var deferral = args.GetDeferral();\n        bool discard = await ShowConfirmationDialog();\n        if (!discard)\n            args.Cancel();\n        deferral.Complete();\n    }\n}\n```\n\n## Tab Configuration\n\n### Bottom Tabs\n\nMultiple `ShellContent` (or `Tab`) children inside a `TabBar` or `FlyoutItem` produce bottom tabs.\n\n### Top Tabs\n\nMultiple `ShellContent` children inside a single `Tab` produce top tabs:\n\n```xml\n\u003CTab Title=\"Photos\">\n    \u003CShellContent Title=\"Recent\"    ContentTemplate=\"{DataTemplate views:RecentPage}\" \u002F>\n    \u003CShellContent Title=\"Favorites\" ContentTemplate=\"{DataTemplate views:FavoritesPage}\" \u002F>\n\u003C\u002FTab>\n```\n\n### Tab Bar Appearance\n\n| Attached Property              | Type    | Purpose                        |\n|--------------------------------|---------|--------------------------------|\n| `Shell.TabBarBackgroundColor`  | `Color` | Tab bar background             |\n| `Shell.TabBarForegroundColor`  | `Color` | Selected icon color            |\n| `Shell.TabBarTitleColor`       | `Color` | Selected tab title color       |\n| `Shell.TabBarUnselectedColor`  | `Color` | Unselected tab icon\u002Ftitle      |\n| `Shell.TabBarIsVisible`        | `bool`  | Show\u002Fhide the tab bar          |\n\n```xml\n\u003C!-- Hide the tab bar on a specific page -->\n\u003CContentPage Shell.TabBarIsVisible=\"False\" ... \u002F>\n```\n\n## Flyout Configuration\n\n### FlyoutBehavior\n\nSet on `Shell`: `Disabled`, `Flyout`, or `Locked`.\n\n```xml\n\u003CShell FlyoutBehavior=\"Flyout\"> ... \u003C\u002FShell>\n```\n\n### FlyoutDisplayOptions\n\nControls how children appear in the flyout:\n\n- `AsSingleItem` (default) — one flyout entry for the group\n- `AsMultipleItems` — each child `Tab` gets its own entry\n\n```xml\n\u003CFlyoutItem Title=\"Animals\" FlyoutDisplayOptions=\"AsMultipleItems\">\n    \u003CTab Title=\"Cats\" ... \u002F>\n    \u003CTab Title=\"Dogs\" ... \u002F>\n\u003C\u002FFlyoutItem>\n```\n\n### MenuItem (Non-Navigation Flyout Entries)\n\n```xml\n\u003CMenuItem Text=\"Log Out\"\n          Command=\"{Binding LogOutCommand}\"\n          IconImageSource=\"logout.png\" \u002F>\n```\n\n## Back Button Behavior\n\nCustomize the back button per page:\n\n```xml\n\u003CShell.BackButtonBehavior>\n    \u003CBackButtonBehavior Command=\"{Binding BackCommand}\"\n                       IconOverride=\"back_arrow.png\"\n                       TextOverride=\"Cancel\"\n                       IsVisible=\"True\" \u002F>\n\u003C\u002FShell.BackButtonBehavior>\n```\n\nProperties: `Command`, `CommandParameter`, `IconOverride`, `TextOverride`, `IsVisible`, `IsEnabled`.\n\n## Inspecting Navigation State\n\n```csharp\n\u002F\u002F Current URI location\nstring location = Shell.Current.CurrentState.Location.ToString();\n\n\u002F\u002F Current page\nPage page = Shell.Current.CurrentPage;\n\n\u002F\u002F Navigation stack of the current tab\nIReadOnlyList\u003CPage> stack = Shell.Current.Navigation.NavigationStack;\n```\n\n## Navigation Events\n\nOverride in `AppShell`:\n\n```csharp\nprotected override void OnNavigated(ShellNavigatedEventArgs args)\n{\n    base.OnNavigated(args);\n    \u002F\u002F args.Current, args.Previous, args.Source\n}\n```\n\n`ShellNavigationSource` values: `Push`, `Pop`, `PopToRoot`, `Insert`, `Remove`, `ShellItemChanged`, `ShellSectionChanged`, `ShellContentChanged`, `Unknown`.\n\n## Common Pitfalls\n\n- **Eager page creation**: Using `Content` directly instead of `ContentTemplate` with `DataTemplate` creates all pages at Shell init, hurting startup time. Always use `ContentTemplate`.\n- **Duplicate route names**: `Routing.RegisterRoute` throws `ArgumentException` if a route name matches an existing route or a visual hierarchy route. Every route must be unique across the app.\n- **Relative routes without registration**: You cannot `GoToAsync(\"somepage\")` unless `somepage` was registered with `Routing.RegisterRoute`. Visual hierarchy pages use absolute `\u002F\u002F` routes.\n- **Fire-and-forget GoToAsync**: Not awaiting `GoToAsync` causes race conditions and silent failures. Always `await` the call.\n- **Wrong absolute route path**: Absolute routes must match the full path through the visual hierarchy (`\u002F\u002FFlyoutItem\u002FTab\u002FShellContent`). Wrong paths produce silent no-ops, not exceptions.\n- **Manipulating Tab.Stack directly**: The navigation stack is read-only. Use `GoToAsync` for all navigation changes.\n- **Forgetting `GetDeferral()` for async guards**: Synchronous cancellation in `OnNavigating` works, but async checks require `GetDeferral()` \u002F `deferral.Complete()` to avoid race conditions.\n\n## References\n\n- `references\u002Fshell-navigation-api.md` — Full API reference for Shell hierarchy, routes, tabs, flyout, and navigation\n- [.NET MAUI Shell Navigation](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Ffundamentals\u002Fshell\u002Fnavigation)\n- [.NET MAUI Shell Tabs](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Ffundamentals\u002Fshell\u002Ftabs)\n- [.NET MAUI Shell Flyout](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Ffundamentals\u002Fshell\u002Fflyout)\n- [.NET MAUI Shell Pages](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Ffundamentals\u002Fshell\u002Fpages)\n","# .NET MAUI Shell Navigation\n\nImplement page navigation in .NET MAUI apps using Shell. Shell provides URI-based navigation, a flyout menu, tab bars, and a four-level visual hierarchy — all configured declaratively in XAML.\n\n## When to Use\n\n- Setting up top-level app navigation with tabs or a flyout menu\n- Navigating between pages programmatically with `GoToAsync`\n- Passing data between pages via query parameters or object parameters\n- Registering detail-page routes for push navigation\n- Guarding navigation with confirmation dialogs (e.g., unsaved changes)\n- Customizing back button behavior per page\n\n## When Not to Use\n\n- Deep linking from external URLs or app links — see [.NET MAUI deep linking docs](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Ffundamentals\u002Fapp-links)\n- Data binding on navigation target pages — use `maui-data-binding`\n- Dependency injection for pages and view models — use `maui-dependency-injection`\n- Apps using `NavigationPage` without Shell (different navigation API)\n\n## Inputs\n\n- A .NET MAUI project with `AppShell.xaml` as the root shell\n- Pages (`ContentPage`) to navigate between\n- Route names for detail pages not in the visual hierarchy\n\n## Rules That Change the Answer\n\nThese are the Shell-specific decisions that are easy to get wrong. Apply them\nwhenever they are relevant to what the user asked.\n\n| Situation | Do this | Not this |\n|---|---|---|\n| Declaring pages in `AppShell.xaml` | With `xmlns:views=\"clr-namespace:MyApp.Views\"` declared: `\u003CShellContent ContentTemplate=\"{DataTemplate views:MyPage}\" \u002F>` — the page is created on first navigation | `\u003CShellContent>\u003Cviews:MyPage \u002F>\u003C\u002FShellContent>`, which constructs **every** page at startup |\n| Navigating to a page not in the visual hierarchy | `Routing.RegisterRoute(\"details\", typeof(DetailsPage))` first | Calling `GoToAsync(\"details\")` unregistered — it throws at runtime |\n| Receiving navigation parameters | Implement `IQueryAttributable` on the **ViewModel** | Implementing it on the Page, which splits state from the BindingContext |\n| Passing a whole object | `ShellNavigationQueryParameters` | Serialising the object into the query string |\n| Any `GoToAsync` call | `await` it | Fire-and-forget — exceptions are swallowed and navigation races |\n| Confirming before back navigation | `ShellNavigatingEventArgs.GetDeferral()` … `deferral.Complete()` | Blocking synchronously on the dialog task |\n| Detecting back navigation | Check `e.Source == ShellNavigationSource.Pop` | Assuming every navigation is a back action |\n\n**Do not** propose `NavigationPage` \u002F `PushAsync` solutions for a Shell app, and do\nnot restructure a working `AppShell` hierarchy unless the user asked.\n\n**Answer narrowly, but completely.** Staying on topic does not mean being terse. When\nyou show a navigation change, include the pieces needed to run it: the `AppShell.xaml`\nmarkup *and* the `Routing.RegisterRoute` call, or the `GoToAsync` call *and* the\nreceiving `IQueryAttributable` \u002F `[QueryProperty]` code. Where two approaches are both\nvalid (query string vs `ShellNavigationQueryParameters`), show both and say when each\nfits — a single snippet the user still has to complete is a worse answer.\n\n## Shell Visual Hierarchy\n\nShell uses a four-level hierarchy. Each level wraps the one below it:\n\n```\nShell\n ├── FlyoutItem \u002F TabBar          (top-level grouping)\n │    ├── Tab                     (bottom-tab grouping)\n │    │    ├── ShellContent        (page slot → ContentPage)\n │    │    └── ShellContent        (multiple = top tabs)\n │    └── Tab\n └── FlyoutItem \u002F TabBar\n```\n\n- **FlyoutItem** — appears in the flyout menu; contains `Tab` children\n- **TabBar** — bottom tab bar with no flyout entry\n- **Tab** — groups `ShellContent`; multiple children produce top tabs\n- **ShellContent** — each points to a `ContentPage`\n\n### Implicit Conversion\n\nYou can omit intermediate wrappers. Shell auto-wraps:\n\n| You write                    | Shell creates                         |\n|------------------------------|---------------------------------------|\n| `ShellContent` only          | `FlyoutItem > Tab > ShellContent`     |\n| `Tab` only                   | `FlyoutItem > Tab`                    |\n| `ShellContent` in `TabBar`   | `TabBar > Tab > ShellContent`         |\n\n## Workflow: Set Up AppShell\n\n1. Define `AppShell.xaml` inheriting from `Shell`\n2. Add `FlyoutItem` or `TabBar` elements for top-level navigation\n3. Add `Tab` elements for bottom tabs; nest multiple `ShellContent` for top tabs\n4. **Always use `ContentTemplate`** with `DataTemplate` so pages load on demand\n5. **Give every `ShellContent` an explicit `Route`** (see below)\n6. Register detail-page routes in the `AppShell` constructor\n\n> **Set `Route=` on every `ShellContent`.** If you omit it, MAUI auto-generates a\n> name from a shared counter — `Routing.cs` produces `D_FAULT_{TypeName}{n}`. A real\n> shell with three unnamed `ShellContent` elements yields routes like\n> `D_FAULT_ShellContent2` and `D_FAULT_ShellContent5`: the numbers are not\n> sequential, they depend on how many Shell elements were constructed first, and they\n> shift when you reorder or add pages. You cannot write a stable absolute route\n> (`\u002F\u002Fdashboard`) or deep link against that. An explicit `Route=\"dashboard\"` is stable\n> forever.\n\n```xml\n\u003CShell xmlns=\"http:\u002F\u002Fschemas.microsoft.com\u002Fdotnet\u002F2021\u002Fmaui\"\n       xmlns:x=\"http:\u002F\u002Fschemas.microsoft.com\u002Fwinfx\u002F2009\u002Fxaml\"\n       xmlns:views=\"clr-namespace:MyApp.Views\"\n       x:Class=\"MyApp.AppShell\"\n       FlyoutBehavior=\"Flyout\">\n\n    \u003CFlyoutItem Title=\"Animals\" Icon=\"animals.png\">\n        \u003CTab Title=\"Cats\">\n            \u003CShellContent Title=\"Domestic\" Route=\"domesticcats\"\n                          ContentTemplate=\"{DataTemplate views:DomesticCatsPage}\" \u002F>\n            \u003CShellContent Title=\"Wild\" Route=\"wildcats\"\n                          ContentTemplate=\"{DataTemplate views:WildCatsPage}\" \u002F>\n        \u003C\u002FTab>\n        \u003CTab Title=\"Dogs\" Icon=\"dogs.png\">\n            \u003CShellContent Route=\"dogs\" ContentTemplate=\"{DataTemplate views:DogsPage}\" \u002F>\n        \u003C\u002FTab>\n    \u003C\u002FFlyoutItem>\n\n    \u003CTabBar>\n        \u003CShellContent Title=\"Home\" Icon=\"home.png\" Route=\"home\"\n                      ContentTemplate=\"{DataTemplate views:HomePage}\" \u002F>\n        \u003CShellContent Title=\"Settings\" Icon=\"settings.png\" Route=\"settings\"\n                      ContentTemplate=\"{DataTemplate views:SettingsPage}\" \u002F>\n    \u003C\u002FTabBar>\n\u003C\u002FShell>\n```\n\n```csharp\n\u002F\u002F AppShell.xaml.cs\npublic partial class AppShell : Shell\n{\n    public AppShell()\n    {\n        InitializeComponent();\n        Routing.RegisterRoute(\"animaldetails\", typeof(AnimalDetailsPage));\n        Routing.RegisterRoute(\"editanimal\", typeof(EditAnimalPage));\n    }\n}\n```\n\n## Workflow: Navigate with GoToAsync\n\nAll programmatic navigation uses `Shell.Current.GoToAsync`. Always `await` the call.\n\n### Route Prefixes\n\n| Prefix | Meaning                                     |\n|--------|---------------------------------------------|\n| `\u002F\u002F`   | Absolute route from Shell root              |\n| (none) | Relative; pushes onto the current nav stack |\n| `..`   | Go back one level                           |\n| `..\u002F`  | Go back then navigate forward               |\n\n### Navigation Examples\n\n```csharp\n\u002F\u002F 1. Absolute — switch to a specific hierarchy location\nawait Shell.Current.GoToAsync(\"\u002F\u002Fanimals\u002Fcats\u002Fdomestic\");\n\n\u002F\u002F 2. Relative — push a registered detail page\nawait Shell.Current.GoToAsync(\"animaldetails\");\n\n\u002F\u002F 3. With query string parameters\nawait Shell.Current.GoToAsync($\"animaldetails?id={animal.Id}\");\n\n\u002F\u002F 4. Go back one page\nawait Shell.Current.GoToAsync(\"..\");\n\n\u002F\u002F 5. Go back two pages\nawait Shell.Current.GoToAsync(\"..\u002F..\");\n\n\u002F\u002F 6. Go back one page, then push a different page\nawait Shell.Current.GoToAsync(\"..\u002Feditanimal\");\n```\n\n## Workflow: Pass Data Between Pages\n\n### Option 1: IQueryAttributable (Preferred)\n\nImplement on ViewModels to receive all parameters in one call:\n\n```csharp\npublic class AnimalDetailsViewModel : ObservableObject, IQueryAttributable\n{\n    public void ApplyQueryAttributes(IDictionary\u003Cstring, object> query)\n    {\n        if (query.TryGetValue(\"id\", out var id))\n            AnimalId = id.ToString();\n    }\n}\n```\n\n### Option 2: QueryProperty Attribute\n\nApply on the **ViewModel** class (or the page, if it genuinely owns the state).\nPrefer `IQueryAttributable` on the ViewModel — it keeps navigation state with the\n`BindingContext` and handles multiple parameters in one call:\n\n```csharp\n[QueryProperty(nameof(AnimalId), \"id\")]\npublic partial class AnimalDetailsViewModel : ObservableObject\n{\n    [ObservableProperty]\n    private string _animalId = string.Empty;\n}\n```\n\nShell applies query attributes *after* the page constructor sets `BindingContext`,\nso the property must raise change notification — a plain auto-property leaves the\nbinding stuck on its initial value.\n\n### Option 3: Complex Objects via ShellNavigationQueryParameters\n\nPass objects without serializing to strings:\n\n```csharp\nvar parameters = new ShellNavigationQueryParameters\n{\n    { \"animal\", selectedAnimal }\n};\nawait Shell.Current.GoToAsync(\"animaldetails\", parameters);\n```\n\nReceive via `IQueryAttributable`:\n\n```csharp\npublic void ApplyQueryAttributes(IDictionary\u003Cstring, object> query)\n{\n    Animal = query[\"animal\"] as Animal;\n}\n```\n\n## Workflow: Guard Navigation\n\nUse `GetDeferral()` in `OnNavigating` for async checks (e.g., \"save unsaved changes?\"):\n\n```csharp\n\u002F\u002F In AppShell.xaml.cs\nprotected override async void OnNavigating(ShellNavigatingEventArgs args)\n{\n    base.OnNavigating(args);\n    if (hasUnsavedChanges && args.Source == ShellNavigationSource.Pop)\n    {\n        var deferral = args.GetDeferral();\n        bool discard = await ShowConfirmationDialog();\n        if (!discard)\n            args.Cancel();\n        deferral.Complete();\n    }\n}\n```\n\n## Tab Configuration\n\n### Bottom Tabs\n\nMultiple `ShellContent` (or `Tab`) children inside a `TabBar` or `FlyoutItem` produce bottom tabs.\n\n### Top Tabs\n\nMultiple `ShellContent` children inside a single `Tab` produce top tabs:\n\n```xml\n\u003CTab Title=\"Photos\">\n    \u003CShellContent Title=\"Recent\"    ContentTemplate=\"{DataTemplate views:RecentPage}\" \u002F>\n    \u003CShellContent Title=\"Favorites\" ContentTemplate=\"{DataTemplate views:FavoritesPage}\" \u002F>\n\u003C\u002FTab>\n```\n\n### Tab Bar Appearance\n\n| Attached Property              | Type    | Purpose                        |\n|--------------------------------|---------|--------------------------------|\n| `Shell.TabBarBackgroundColor`  | `Color` | Tab bar background             |\n| `Shell.TabBarForegroundColor`  | `Color` | Selected icon color            |\n| `Shell.TabBarTitleColor`       | `Color` | Selected tab title color       |\n| `Shell.TabBarUnselectedColor`  | `Color` | Unselected tab icon\u002Ftitle      |\n| `Shell.TabBarIsVisible`        | `bool`  | Show\u002Fhide the tab bar          |\n\n```xml\n\u003C!-- Hide the tab bar on a specific page -->\n\u003CContentPage Shell.TabBarIsVisible=\"False\" ... \u002F>\n```\n\n## Flyout Configuration\n\n### FlyoutBehavior\n\nSet on `Shell`: `Disabled`, `Flyout`, or `Locked`.\n\n```xml\n\u003CShell FlyoutBehavior=\"Flyout\"> ... \u003C\u002FShell>\n```\n\n### FlyoutDisplayOptions\n\nControls how children appear in the flyout:\n\n- `AsSingleItem` (default) — one flyout entry for the group\n- `AsMultipleItems` — each child `Tab` gets its own entry\n\n```xml\n\u003CFlyoutItem Title=\"Animals\" FlyoutDisplayOptions=\"AsMultipleItems\">\n    \u003CTab Title=\"Cats\" ... \u002F>\n    \u003CTab Title=\"Dogs\" ... \u002F>\n\u003C\u002FFlyoutItem>\n```\n\n### MenuItem (Non-Navigation Flyout Entries)\n\n```xml\n\u003CMenuItem Text=\"Log Out\"\n          Command=\"{Binding LogOutCommand}\"\n          IconImageSource=\"logout.png\" \u002F>\n```\n\n## Back Button Behavior\n\nCustomize the back button per page:\n\n```xml\n\u003CShell.BackButtonBehavior>\n    \u003CBackButtonBehavior Command=\"{Binding BackCommand}\"\n                       IconOverride=\"back_arrow.png\"\n                       TextOverride=\"Cancel\"\n                       IsVisible=\"True\" \u002F>\n\u003C\u002FShell.BackButtonBehavior>\n```\n\nProperties: `Command`, `CommandParameter`, `IconOverride`, `TextOverride`, `IsVisible`, `IsEnabled`.\n\n## Inspecting Navigation State\n\n```csharp\n\u002F\u002F Current URI location\nstring location = Shell.Current.CurrentState.Location.ToString();\n\n\u002F\u002F Current page\nPage page = Shell.Current.CurrentPage;\n\n\u002F\u002F Navigation stack of the current tab\nIReadOnlyList\u003CPage> stack = Shell.Current.Navigation.NavigationStack;\n```\n\n## Navigation Events\n\nOverride in `AppShell`:\n\n```csharp\nprotected override void OnNavigated(ShellNavigatedEventArgs args)\n{\n    base.OnNavigated(args);\n    \u002F\u002F args.Current, args.Previous, args.Source\n}\n```\n\n`ShellNavigationSource` values: `Push`, `Pop`, `PopToRoot`, `Insert`, `Remove`, `ShellItemChanged`, `ShellSectionChanged`, `ShellContentChanged`, `Unknown`.\n\n## Common Pitfalls\n\n- **Eager page creation**: Using `Content` directly instead of `ContentTemplate` with `DataTemplate` creates all pages at Shell init, hurting startup time. Always use `ContentTemplate`.\n- **Duplicate route names**: `Routing.RegisterRoute` throws `ArgumentException` if a route name matches an existing route or a visual hierarchy route. Every route must be unique across the app.\n- **Relative routes without registration**: You cannot `GoToAsync(\"somepage\")` unless `somepage` was registered with `Routing.RegisterRoute`. Visual hierarchy pages use absolute `\u002F\u002F` routes.\n- **Fire-and-forget GoToAsync**: Not awaiting `GoToAsync` causes race conditions and silent failures. Always `await` the call.\n- **Wrong absolute route path**: Absolute routes must match the full path through the visual hierarchy (`\u002F\u002FFlyoutItem\u002FTab\u002FShellContent`). Wrong paths produce silent no-ops, not exceptions.\n- **Manipulating Tab.Stack directly**: The navigation stack is read-only. Use `GoToAsync` for all navigation changes.\n- **Forgetting `GetDeferral()` for async guards**: Synchronous cancellation in `OnNavigating` works, but async checks require `GetDeferral()` \u002F `deferral.Complete()` to avoid race conditions.\n\n## References\n\n- `references\u002Fshell-navigation-api.md` — Full API reference for Shell hierarchy, routes, tabs, flyout, and navigation\n- [.NET MAUI Shell Navigation](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Ffundamentals\u002Fshell\u002Fnavigation)\n- [.NET MAUI Shell Tabs](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Ffundamentals\u002Fshell\u002Ftabs)\n- [.NET MAUI Shell Flyout](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Ffundamentals\u002Fshell\u002Fflyout)\n- [.NET MAUI Shell Pages](https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fmaui\u002Ffundamentals\u002Fshell\u002Fpages)\n",{"name":5,"license":15,"description":7},"main","30954af1dcd1a74b63f05deb2e2c41e5ecae4a82","10-Mobile-Development\u002Fmaui-shell-navigation","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack","https:\u002F\u002Fgithub.com\u002Fitsmejay18","2026-09-18 16:06:36",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill maui-shell-navigation",{"tool":36,"command":37},"bunx","bunx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill maui-shell-navigation",{"tool":39,"command":40},"pnpm","pnpm dlx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill maui-shell-navigation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F10-Mobile-Development\u002Fmaui-shell-navigation\u002FSKILL.md",true,[44],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"references\u002Fshell-navigation-api.md","REFERENCE","参考文档",9219,"https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F10-Mobile-Development\u002Fmaui-shell-navigation\u002Freferences\u002Fshell-navigation-api.md",[51,58,65,72,79,86],{"skillNo":52,"name":53,"nameZh":6,"description":54,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M7D2RKBHPZ3E1RNN5DWHT550","vectorization","Design, implement, optimize, and review SIMD code in .NET. USE FOR: vectorizing scalar loops with TensorPrimitives, Vector64\u002F128\u002F256\u002F512, or platform hardware intrinsics; reviewing existing SIMD code, including Vector\u003CT>, for contract equivalence, tail handling, memory safety, portability, fallbacks, and measured performance. DO NOT USE FOR: performance work unrelated to SIMD or vectorization.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fvectorization\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M7D2RDJ7RN3QK8GJR0QTER1D","resolve-project-references","Guide for interpreting ResolveProjectReferences time in MSBuild performance summaries. Activate when ResolveProjectReferences appears as the most expensive target and developers are trying to optimize it directly. Explains that the reported time includes wait time for dependent project builds and is misleading. Guides users to focus on task self-time instead. Do not activate for general build performance -- use build-perf-diagnostics instead.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fresolve-project-references\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7D2R1H2GTNZYHG9YRX3JDQW","optimizing-ef-core-queries","Optimize and improve the performance of slow Entity Framework Core (EF Core) queries: make them generate less SQL, make fewer database round-trips, and return results faster. Use whenever an EF Core or DbContext query or data-access path is slow or should be made faster — whether or not EF Core owns the database schema. For EF Core, not Dapper or raw ADO.NET.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Foptimizing-ef-core-queries\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M7D2QREG04W1YT0NEBHEW5C9","microbenchmarking","Activate this skill when BenchmarkDotNet (BDN) is involved in the task — creating, running, configuring, or reviewing BDN benchmarks. Also activate when microbenchmarking .NET code would be useful and BenchmarkDotNet is the likely tool. Consider activating when answering a .NET performance question requires measurement and BenchmarkDotNet may be needed. Covers microbenchmark design, BDN configuration and project setup, how to run BDN microbenchmarks efficiently and effectively, and using BDN for side-by-side performance comparisons. Do NOT use for profiling\u002Ftracing .NET code (dotnet-trace, PerfView), production telemetry, or load\u002Fstress testing (Crank, k6).","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fmicrobenchmarking\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7D2QGE175XWPZVACVH2868Z","incremental-build","Guide for optimizing MSBuild incremental builds. USE FOR: builds slower than expected on subsequent runs, 'nothing changed but it rebuilds anyway', diagnosing why targets re-execute unnecessarily, fixing broken no-op builds. Covers 8 common causes: missing Inputs\u002FOutputs on custom targets, volatile properties in output paths (timestamps\u002FGUIDs), file writes outside tracked Outputs, missing FileWrites registration, glob changes, Visual Studio Fast Up-to-Date Check (FUTDC) issues. Key diagnostic: look for 'Building target completely' vs 'Skipping target' in binlog. DO NOT USE FOR: first-time build slowness (use build-perf-baseline), parallelism issues (use build-parallelism), evaluation-phase slowness (use eval-performance), non-MSBuild build systems.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fincremental-build\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M7D2Q1DQTC6K49R73WQTTPSB","eval-performance","Guide for diagnosing and improving MSBuild project evaluation performance. USE FOR: builds slow before any compilation starts, high evaluation time in binlog analysis, expensive glob patterns walking large directories (node_modules, .git, bin\u002Fobj), deep import chains (>20 levels), preprocessed output >10K lines indicating heavy evaluation, property functions with file I\u002FO ($([System.IO.File]::ReadAllText(...))), multiple evaluations per project. Covers the 5 MSBuild evaluation phases, glob optimization via DefaultItemExcludes, import chain analysis with \u002Fpp preprocessing. DO NOT USE FOR: compilation-time slowness (use build-perf-diagnostics), incremental build issues (use incremental-build), non-MSBuild build systems.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Feval-performance\u002FSKILL.md",[],[]]