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.mdSalin 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
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
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
NavigationPagewithout Shell (different navigation API)
Inputs
- A .NET MAUI project with
AppShell.xamlas 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
Tabchildren - 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
- Define
AppShell.xamlinheriting fromShell - Add
FlyoutItemorTabBarelements for top-level navigation - Add
Tabelements for bottom tabs; nest multipleShellContentfor top tabs - **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
Komentar
- β¦
Skill lain dari repositori ini
create-custom-agent
5.8kMembantu agent Anda membuat file agen kustom VS Code dengan alatnya sendiri, instruksi, dan serah terima ke agent lain.
create-skill
5.8kMembantu agent Anda membuat skill agent baru dengan nama yang valid, deskripsi pemicu yang jelas, dan file SKILL.md yang mengikuti standar.
csharp-scripts
5.8kMembantu agent Anda menjalankan program C# kecil sebagai satu file dengan alat baris perintah .NET, tanpa membuat proyek lengkap.
dotnet-pinvoke
5.8kMembantu agent Anda memanggil pustaka native C atau C++ dari .NET dengan benar, mencakup tanda tangan, penanganan string, memori, dan safe handle.
Skill serupa
android-clean-architecture
280kMembuat agent Anda mengatur proyek Android dengan efisien. Struktur kodenya dibuat agar lebih mudah dirawat dan pengembangan fitur baru.
compose-multiplatform-patterns
280kMembantu agent Anda menggunakan pola Compose Multiplatform dan Jetpack Compose di proyek KMP, mencakup state, navigasi, theming, dan performa.
dart-flutter-patterns
280kMembuat agent Anda menulis kode untuk aplikasi Dart dan Flutter. Menggunakan pola modern agar aplikasi kokoh dan mudah dikelola.