25 Most Frequently Asked .NET MAUI & Xamarin Interview Questions and Answers (2025)

Blog / 25 Most Frequently Asked .NET MAUI & Xamarin Interview Questions and Answers (2025)
blog image

.NET MAUI and Xamarin turn a single C# codebase into truly native apps across iOS, Android, macOS, and Windows.

Knowing how the abstraction layers, from XAML markup to platform renderers and handlers, map to underlying native controls lets you debug quirks, squeeze out performance, and impress your interviewers.

Q1.

What is .NET MAUI and how is it related to Xamarin.Forms?

Junior
  • .NET MAUI is the modern successor to Xamarin.Forms - a single-project, cross-platform framework in the .NET 6+ ecosystem for building native iOS, Android, Windows, and macOS apps with C# and XAML.
  • It retains Xamarin’s “write once, run anywhere” approach but adds a unified project structure and the latest .NET runtime for faster performance, better tooling, and broader platform support.o3
Q2.

Which platforms can you target with .NET MAUI?

Junior

.NET MAUI supports Android, iOS, Windows, and macOS out of the box. Specifically:

  • Android: (via .NET for Android) for phones & tablets (Android 5.0/API 21 and above).
  • iOS: (via .NET for iOS) for iPhones/iPads (iOS 11 and above).
  • Windows: (via WinUI 3) for Windows 10/11 desktop apps.
  • macOS: (via Mac Catalyst) for native Mac desktop apps.

These are all achieved with one codebase. There is no official Linux or web target in MAUI, although Blazor Hybrid allows embedding web UI (Blazor) in a MAUI app (more on that later). In summary, MAUI covers the major mobile and desktop platforms within a single framework.

Q3.

What is the significance of .NET MAUI’s single-project structure?

Junior

.NET MAUI keeps everything in one project instead of separate platform projects. Shared code, assets, and references sit together, while any platform-specific code lives in the Platforms/ folders (Android, iOS, Windows, macOS). This unified setup:

  • Centralizes resources - add an image or font once, MAUI auto-sizes and packs it for every platform;
  • Cuts duplication and configuration hassle;
  • Lets the build system output the correct app bundle for each target;
  • Ultimately makes cross-platform apps easier to manage and maintain.
Q4.

How do you define the UI layout in a .NET MAUI app?

Junior

.NET MAUI UIs are defined in either XAML or C#:

  • XAML (preferred): an XML-based markup where you declaratively list pages, layouts, and controls.
    • XAML is concise, MVVM-friendly, and supports Hot Reload for instant visual updates.
  • C# code: build the same UI by instantiating controls and adding them to layouts, handy for dynamic or code-generated views.

You can mix both: use XAML for the static layout and C# for runtime adjustments.

Q5.

What is XAML in the context of .NET MAUI and why would you use it?

Junior
  • XAML (Extensible Application Markup Language) is an XML-based markup for declaring MAUI pages, layouts, and controls (e.g., <Button Text="Save" Command="{Binding SaveCommand}"/>).
  • Why use it? It’s succinct, matches the visual hierarchy, supports MVVM data-binding, IntelliSense, designers, and Hot Reload - so you build UIs faster and keep layout separate from logic.
  • Without XAML? Yes. Every XAML page has an equivalent C# partial class, and you can build the entire UI in C# (useful for dynamic views or fluent APIs). XAML is recommended for most cases, but code-only UIs are fully supported.

Don't let one question ruin your next technical interview...

Q6.

Name some common UI controls in .NET MAUI and their uses.

Junior

.NET MAUI provides a set of cross-platform UI controls (which map to native controls on each platform). Some common ones include:

  • Label: for displaying text.
  • Button: a tappable button for user clicks.
  • Entry: single-line text input field (for entering text like usernames, etc.).
  • Editor: multi-line text input area.
  • Image: for displaying images or icons.
  • Checkbox/Switch: for boolean on/off input.
  • Slider: for numeric range input via sliding thumb.
  • Picker: drop-down list selector.
  • DatePicker/TimePicker: controls for date or time selection using native pickers.
  • WebView: to display web content inside the app.

All live in Microsoft.Maui.Controls and are rendered as the corresponding native widgets on each platform (e.g., UIButton on iOS, MaterialButton on Android), giving you a familiar API with true native appearance and behavior.

Q7.

Explain the MVVM pattern in simple terms and why it’s used in Xamarin/Maui apps.

Junior

MVVM:

  • Model: Your data and business services (e.g., web-API calls, database entities).
  • View: The XAML/C# UI that users see and touch.
  • ViewModel: A C# class that sits between them, exposing bindable properties and commands but knowing nothing about the View.

Why use it in Xamarin.Forms / .NET MAUI?

  • Built-in data binding lets the View auto-reflect ViewModel property changes and relay user input back - minimal glue code.
  • Separation of concerns: UI styling stays in the View; app logic lives in the ViewModel; data stays in Models.
  • Testability: ViewModels are plain C#, so you can unit-test logic without UI frameworks.
  • Maintainability/extensibility: swap or redesign views without touching logic; add new features by extending ViewModels and Models.

MAUI doesn’t require MVVM, but its binding infrastructure makes MVVM the most natural, organized way to build cross-platform UIs.

Q8.

How does data binding work in .NET MAUI?

Mid

Data binding keeps View and ViewModel automatically in sync, eliminating manual UI update code.

  • Every control has a BindingContext - usually a ViewModel.
  • Bind with the {Binding …} syntax in XAML:
  • The ViewModel implements INotifyPropertyChanged; when UserName raises PropertyChanged, the UI refreshes, and (with TwoWay) user edits flow back to the ViewModel.
  • Any bindable property (visibility, color, etc.) can be used, and IValueConverter can transform values.
Q9.

What is INotifyPropertyChanged and how does it relate to data binding?

Mid
  • INotifyPropertyChanged is a .NET interface with one event, PropertyChanged.
  • A ViewModel implements it and raises PropertyChanged whenever a bound property changes:
  • The MAUI binding engine listens for that event; when it fires, any UI element bound to that property refreshes automatically (and, with two-way bindings, user edits propagate back).
  • Thus, INotifyPropertyChanged is the glue that keeps View ↔ ViewModel data in sync.
Q10.

How do Commands (ICommand) work in MVVM for .NET MAUI?

Mid
  • ICommand represents an action plus an optional CanExecute rule.
  • In the ViewModel you expose a command - typically with MAUI’s built-in Command helper:
  • In XAML bind a control’s Command property:
  • When the user taps the button, the binding engine calls SaveCommand.Execute; if CanExecute returns false, the button is disabled.
  • This keeps UI actions in the ViewModel (no code-behind), aligning with MVVM and making the logic easy to unit-test.
Q11.

How can you display a list of items in a .NET MAUI app?

Mid
  • Use CollectionView (preferred over legacy ListView) to show a scrollable list.
  • Bind its ItemsSource to a collection - typically an ObservableCollection<T> in your ViewModel.
  • Provide an ItemTemplate to define each row’s appearance:
  • CollectionView virtualizes items for performance and supports selection via events or bound commands - ideal for any long, data-bound list in .NET MAUI.
Q12.

What is an ObservableCollection and why would you use it in a MAUI app?

Mid
  • ObservableCollection<T> is a list that raises collection-changed events (implements INotifyCollectionChanged) whenever items are added, removed, or replaced.
  • Binding a MAUI CollectionView, Picker, etc. to an ObservableCollection means the UI auto-refreshes as the collection changes - no manual refresh code needed.
  • Use it in ViewModels for data that updates at runtime (e.g., chat messages, loaded items), giving you the same automatic sync for lists that INotifyPropertyChanged provides for single properties.
Q13.

How does the .NET MAUI application lifecycle work?

Mid
  • OnStart: Fires once when the app launches; use it for initial setup.
  • OnSleep: Fires when the app moves to the background; save state or release resources here.
  • OnResume: Fires when the app returns to the foreground; restore or refresh state/UI.

Override these three methods in App.xaml.cs (your Application subclass). They abstract each platform’s native pause/resume events, letting you manage startup, backgrounding, and foregrounding from one place.

Q14.

How does .NET MAUI handle platform-specific code or features?

Mid
  • Partial classes / #if directives: Place platform-only code in Platforms/Android, Platforms/iOS, etc., or wrap blocks with #if ANDROID … #elif IOS … #endif.
  • Dependency injection: Define an interface in shared code, add platform implementations in the Platforms folders, register them in MauiProgram, and inject where needed (supersedes old DependencyService).
  • .NET MAUI Essentials: One-stop APIs for sensors, GPS, battery, dialer, etc.; hides platform specifics so you often need no custom code at all.
  • Custom handlers/effects: For deep control tweaks, write a platform-specific handler that swaps in native widgets or behaviors.

These options let you keep most code shared while dropping to native APIs only when necessary.

Q15.

What is .NET MAUI Shell and what are its benefits?

Mid

.NET MAUI Shell is a built-in container (defined in AppShell.xaml) that declares your app’s pages, flyouts, and tabs, and handles navigation for you.

Why use it?

  • URI-based navigation: Shell.Current.GoToAsync("route") builds pages and manages the stack automatically.
  • Flyout + tabs out of the box: Declare a FlyoutItem or TabBar, and Shell renders the hamburger menu or bottom tabs with no extra code.
  • Hierarchical routes & query parameters: Easy deep-linking and modal navigation.
  • Consistent look: One place to set nav-bar colors, titles, and back-button behavior across the app.
  • Less boilerplate, faster startup: Replaces manually wiring NavigationPage, TabbedPage, etc., reducing code and load time.

In short, Shell centralizes structure and navigation, making multi-page MAUI apps simpler and more scalable.

Q16.

How is dependency injection used in .NET MAUI and what are its advantages?

Mid

Built-in container

  • In MauiProgram.CreateMauiApp() you register services with the same Microsoft.Extensions.DependencyInjection API used in ASP.NET Core:
    • MAUI then builds a ServiceProvider and stores it globally.

Constructor injection everywhere

  • When the framework creates a page, viewmodel, or service, it automatically supplies any constructor parameters it knows about.

Advantages

  • Loose coupling: Classes depend on interfaces, not concrete types.
  • Testability: Swap in mocks/fakes during unit tests.
  • Centralized setup: All wiring lives in one file, following the generic host/builder.Services pattern shared across modern .NET.
  • Cleaner than Xamarin.Forms’ DependencyService: No reflection-based lookups or static service locators.
Q17.

How would you call a web API (RESTful service) from a .NET MAUI app?

Mid
  • Inject or create an HttpClient
  • Call the API asynchronously
  • Expose the data through a ViewModel
  • Bind to the UI (CollectionView, labels, etc.), and notify via INotifyPropertyChanged.
Q18.

How can you store data locally in a .NET MAUI app?

Senior

Choose Preferences for quick settings, SQLite for queryable data, and raw files for custom or large blobs - all with cross-platform APIs included in .NET MAUI.

  • Preferences / SecureStorage
    • Key-value pairs for small settings or tokens: Preferences.Set("AuthToken", token); / Preferences.Get("AuthToken", "")
    • Use SecureStorage for sensitive data (Keychain / KeyStore under the hood).
  • SQLite
    • For structured or larger data. Add sqlite-net-pcl or EF Core SQLite.
    • Store the DB file in FileSystem.AppDataDirectory and use SQLiteConnection / SQLiteAsyncConnection for CRUD.
  • File I/O
    • Write/read text, JSON, or binary files directly with System.IO in FileSystem.AppDataDirectory (or CacheDirectory for temporary data).
Q19.

What is a value converter (IValueConverter) in XAML and when would you use one?

Senior
  • An IValueConverter adapts a bound value to the type or format the UI needs during data-binding; implement Convert (and optionally ConvertBack) in a small class.
  • Typical use-cases:
    • bool → visibility or color
    • DateTime → formatted string
    • number → currency text, etc.
  • Example (bool to color):
  • Converters keep presentation logic out of your ViewModel and can be reused across multiple views.
Q20.

How do you apply styling and theming in .NET MAUI (e.g., define styles or support dark mode)?

Senior
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.
Q21.

How would you ensure your UI is responsive on different device screen sizes in .NET MAUI?

Senior
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.
Q22.

How do you implement platform-specific dependencies in .NET MAUI compared to Xamarin.Forms’ DependencyService?

Senior
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.
Q23.

How would you unit test a .NET MAUI application?

Senior
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.
Q24.

What is .NET MAUI Hot Reload and how does it improve developer productivity?

Senior
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.
Q25.

How do you display a simple popup dialog (like an alert) in a .NET MAUI app?

Senior
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.

About TechPrep

TechPrep has helped thousands of engineers land their dream jobs in Big Tech and beyond. Covering 60+ topics, including coding and DSA challenges, system design write-ups, and interactive quizzes, TechPrep saves you time, builds your confidence, and makes technical interviews a breeze.