Skip to main content

.NET MAUI Cross-Platform App Prompt for Shared UI and Native APIs

Build cross-platform .NET MAUI apps — shared XAML UI, platform-specific code, Shell navigation, offline sync, and native API access.

Füllen Sie die Platzhalter aus

Edit the values, then copy your finished prompt.

Ihr Prompt
prompt.txt

                                

What this prompt does

This prompt builds a .NET MAUI cross-platform application for an [app_purpose] targeting [platforms]. It organizes the project with an [architecture_pattern] and Shell navigation, defines routes for [screens], creates [shared_pages] shared XAML pages that adapt across phone, tablet, and desktop using OnPlatform and OnIdiom, and implements [platform_features] through partial classes and conditional compilation. It also sets up an offline-first data layer with [local_storage] and native API access for [native_apis].

The structure works because one codebase across iOS, Android, and desktop only stays maintainable if the platform seams are deliberate. The prompt establishes where OnPlatform divergence and dependency-injection abstractions matter most, sets up Shell flyout, tab, and modal navigation for [menu_items], [tab_items], and [modal_pages], and includes a testing step with [test_approach]. Offline-first caching that syncs when online is treated as a first-class concern rather than bolted on later.

When to use it

  • A client needs one codebase across [platforms] instead of separate native apps
  • You are planning Shell navigation and routes for [screens] before building
  • You need shared XAML that adapts across form factors via OnPlatform and OnIdiom
  • You need platform-specific features like [platform_features] abstracted cleanly
  • You want an offline-first data layer with [local_storage] that syncs when connectivity returns
  • You need native APIs such as [native_apis] integrated through proper handlers

Example output

Expect a project plan and code: an MVVM-structured solution with Shell routes, shared XAML pages using OnPlatform and OnIdiom for responsive layout, partial-class abstractions for platform-specific features, an offline-first data layer with local caching and sync logic, Shell navigation configured for flyout, tab, and modal pages, DI registration with platform-specific implementations, native-API integration via handlers or the Community Toolkit, and unit and UI test setup.

Pro tips

  • Name your [platforms] precisely, since Windows desktop and mobile differ enough that OnIdiom and OnPlatform branches need real thought, not copy-paste
  • Keep [platform_features] behind an interface so ViewModels stay testable and platform code lives only in the partial-class implementations
  • Design the offline-first layer around conflict resolution early; deciding how [local_storage] reconciles with the server after reconnect is harder to retrofit
  • Register [di_services] with platform-specific implementations so the same ViewModel runs everywhere while the concrete service swaps per platform
  • Use the Community Toolkit for common [native_apis] before writing custom handlers, since it covers camera, geolocation, and notifications already
  • Treat UI tests with [test_approach] as a smoke layer; they are slower and flakier than ViewModel unit tests, so put most assertions in the latter
  • Map your [screens] to Shell routes early so deep linking and back-navigation behave consistently rather than being patched in later
  • Test responsive layouts on a real tablet and desktop, not just a phone emulator, since OnIdiom branches are easy to get subtly wrong across form factors

Frequently Asked Questions

Can one MAUI codebase really target iOS, Android, and Windows?
Yes, that is MAUI's core purpose, and the prompt builds shared XAML pages that adapt across your `[platforms]` using `OnPlatform` and `OnIdiom`. Platform-specific behavior lives in partial classes and conditional compilation, so most UI and logic is shared while genuine platform differences stay isolated behind clean seams.
How does the offline-first data layer work?
It uses your `[local_storage]`, such as SQLite, to cache data locally and sync with the backend when connectivity returns. The prompt treats this as a first-class concern, but you should define conflict-resolution rules for how local changes reconcile with the server, since that logic is hard to retrofit once data diverges.
How are platform-specific features like camera or GPS handled?
Through partial classes and conditional compilation behind an abstraction layer, plus Community Toolkit features where available for `[native_apis]`. Keeping these behind interfaces means your ViewModels stay testable and platform code is confined to the per-platform implementations rather than scattered through shared logic.
What testing approach does it set up?
It configures unit tests for ViewModels plus UI tests using your `[test_approach]`, such as Appium with NUnit. Put most of your assertions in ViewModel unit tests since they are fast and reliable, and treat the cross-platform UI tests as a slower smoke layer that catches integration issues.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

Mehr in C# & .NET Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support