Langsung ke konten
Skillpedia
Aplikasi mobile5.8k Β· #14588

maui-shell-navigation

Fungsinya

Skill ini memandu navigasi antar halaman di aplikasi .NET MAUI memakai Shell, termasuk tab, menu flyout, dan rute antar halaman. Skill ini untuk pengembang yang membangun struktur navigasi aplikasi MAUI.

Kapan dipakai

  • βœ“Saat Anda membutuhkan tab atau menu flyout untuk struktur utama aplikasi MAUI.
  • βœ“Saat Anda ingin berpindah antar halaman dalam kode memakai rute.
  • βœ“Saat Anda ingin bertanya kepada pengguna sebelum meninggalkan halaman yang memiliki perubahan belum disimpan.

Link skill

https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/maui-shell-navigation/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/maui-shell-navigation/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œAtur navigasi Shell untuk aplikasi MAUI saya dengan tiga tab dan halaman detail yang terbuka dari daftar.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent mengatur struktur shell di file XAML, mendaftarkan rute untuk halaman detail, dan memakai navigasi berbasis rute untuk berpindah halaman, dengan data yang diteruskan sebagai parameter.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

.NET MAUI Shell Navigation

Implement 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.

When to Use

  • Setting up top-level app navigation with tabs or a flyout menu
  • Navigating between pages programmatically with GoToAsync
  • Passing data between pages via query parameters or object parameters
  • Registering detail-page routes for push navigation
  • Guarding navigation with confirmation dialogs (e.g., unsaved changes)
  • Customizing back button behavior per page

When Not to Use

  • Deep linking from external URLs or app links β€” see .NET MAUI deep linking docs
  • Data binding on navigation target pages β€” use maui-data-binding
  • Dependency injection for pages and view models β€” use maui-dependency-injection
  • Apps using NavigationPage without Shell (different navigation API)

Inputs

  • A .NET MAUI project with AppShell.xaml as the root shell
  • Pages (ContentPage) to navigate between
  • Route names for detail pages not in the visual hierarchy

Rules That Change the Answer

These are the Shell-specific decisions that are easy to get wrong. Apply them whenever they are relevant to what the user asked.

Situation Do this Not this
Declaring pages in AppShell.xaml With xmlns:views="clr-namespace:MyApp.Views" declared: <ShellContent ContentTemplate="{DataTemplate views:MyPage}" /> β€” the page is created on first navigation <ShellContent><views:MyPage /></ShellContent>, which constructs every page at startup
Navigating to a page not in the visual hierarchy Routing.RegisterRoute("details", typeof(DetailsPage)) first Calling GoToAsync("details") unregistered β€” it throws at runtime
Receiving navigation parameters Implement IQueryAttributable on the ViewModel Implementing it on the Page, which splits state from the BindingContext
Passing a whole object ShellNavigationQueryParameters Serialising the object into the query string
Any GoToAsync call await it Fire-and-forget β€” exceptions are swallowed and navigation races
Confirming before back navigation ShellNavigatingEventArgs.GetDeferral() … deferral.Complete() Blocking synchronously on the dialog task
Detecting back navigation Check e.Source == ShellNavigationSource.Pop Assuming every navigation is a back action

Do not propose NavigationPage / PushAsync solutions for a Shell app, and do not restructure a working AppShell hierarchy unless the user asked.

Answer narrowly, but completely. Staying on topic does not mean being terse. When you show a navigation change, include the pieces needed to run it: the AppShell.xaml markup and the Routing.RegisterRoute call, or the GoToAsync call and the receiving IQueryAttributable / [QueryProperty] code. Where two approaches are both valid (query string vs ShellNavigationQueryParameters), show both and say when each fits β€” a single snippet the user still has to complete is a worse answer.

Shell Visual Hierarchy

Shell uses a four-level hierarchy. Each level wraps the one below it:

Shell
 β”œβ”€β”€ FlyoutItem / TabBar          (top-level grouping)
 β”‚    β”œβ”€β”€ Tab                     (bottom-tab grouping)
 β”‚    β”‚    β”œβ”€β”€ ShellContent        (page slot β†’ ContentPage)
 β”‚    β”‚    └── ShellContent        (multiple = top tabs)
 β”‚    └── Tab
 └── FlyoutItem / TabBar
  • FlyoutItem β€” appears in the flyout menu; contains Tab children
  • TabBar β€” bottom tab bar with no flyout entry
  • Tab β€” groups ShellContent; multiple children produce top tabs
  • ShellContent β€” each points to a ContentPage

Implicit Conversion

You can omit intermediate wrappers. Shell auto-wraps:

You write Shell creates
ShellContent only FlyoutItem > Tab > ShellContent
Tab only FlyoutItem > Tab
ShellContent in TabBar TabBar > Tab > ShellContent

Workflow: Set Up AppShell

  1. Define AppShell.xaml inheriting from Shell
  2. Add FlyoutItem or TabBar elements for top-level navigation
  3. Add Tab elements for bottom tabs; nest multiple ShellContent for top tabs
  4. **Always use `Content
Pertanyaan umum

Apa itu Shell?

Shell adalah struktur navigasi bawaan .NET MAUI, dengan tab, flyout, dan rute.

Bisakah saya mengirim data ke halaman?

Bisa. Data dapat diteruskan dengan parameter kueri atau parameter objek.

Apakah skill ini mencakup deep link?

Tidak. Deep link dari tautan luar dibahas dalam dokumentasi terpisah.

Detail

Deskripsi asli dari pembuat

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

repo: dotnet/skills

Popularitas

Bintang GitHub
5.8k
Peringkat
#14588
Lisensi
MIT
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa