.NET MAUI Tutorial
Learn .NET MAUI step by step: 42 lessons in 9 chapters with examples, quizzes, diagrams and projects.
Start learning →
of lessons completed
Getting Started
- What Is .NET MAUI? Learn what .NET MAUI is, which platforms it targets, how one C# codebase becomes Android, iOS, macOS and Windows apps, and what you can run on this site.
- Setting Up and Creating Your First App Install the .NET SDK and MAUI workload, create a project with Visual Studio or the dotnet CLI, run it on Android, Windows, iOS or macOS, and understand the click-counter template.
- Project Structure Explained Tour a .NET MAUI project - the single csproj, Platforms folder, Resources for images, fonts and icons, MauiProgram, App.xaml, AppShell and how resources are processed per platform.
- App Lifecycle and MauiProgram Understand how a MAUI app starts - MauiProgram.CreateMauiApp, the builder, App and Window classes, lifecycle events such as Created, Activated and Stopped, and how to react to them.
XAML and Layouts
- XAML Basics Learn XAML for .NET MAUI - elements as objects, attributes as properties, property elements, content properties, event handlers, x:Name, namespaces, comments and how XAML relates to C#.
- Stack and Grid Layouts Learn VerticalStackLayout, HorizontalStackLayout and Grid in .NET MAUI - spacing, padding, Auto, star and absolute sizes, row and column spans, plus a runnable star-size solver.
- Flex and Absolute Layouts Learn FlexLayout (direction, wrap, justify, align, grow, shrink, basis) and AbsoluteLayout (proportional bounds) in .NET MAUI, plus runnable wrapping and proportional layout stand-ins.
- Sizing, Alignment and Spacing Learn WidthRequest, HeightRequest, HorizontalOptions, VerticalOptions, Margin, Padding, Thickness, safe areas, device-independent units and how MAUI measures and arranges controls.
- Namespaces and Markup Extensions Learn XAML namespaces (xmlns, clr-namespace), the x: language features, and markup extensions such as StaticResource, DynamicResource, Binding, x:Static, x:Type, x:Null and OnPlatform.
Controls and Binding
- Common Controls A tour of the everyday .NET MAUI controls - Label, Button, Entry, Editor, Image, Switch, Slider, Stepper, ProgressBar, ActivityIndicator, Border and ImageButton - with properties and events.
- Input Controls and Pickers Collect choices in .NET MAUI with Picker, DatePicker, TimePicker, CheckBox, RadioButton, SearchBar and Switch: key properties, events, selected values and a runnable selection-logic stand-in.
- Data Binding Basics Understand .NET MAUI data binding: BindingContext, the Binding markup extension, paths, INotifyPropertyChanged, compiled bindings with x:DataType, and a runnable stand-in of the change-notification engine.
- Binding Modes and Value Converters Learn the .NET MAUI binding modes (OneWay, TwoWay, OneTime, OneWayToSource), StringFormat, IValueConverter, IMultiValueConverter and UpdateSourceEventName, with runnable converter stand-ins.
- CollectionView and Lists Show lists in .NET MAUI with CollectionView: ItemsSource, DataTemplate, ObservableCollection, selection, grouping, EmptyView, RefreshView and layouts, with runnable collection stand-ins.
- Input Validation and Forms Validate user input in .NET MAUI forms: Entry behaviors, the Community Toolkit validation behaviors, INotifyDataErrorInfo, validation rules in the view model and a runnable validator stand-in.
MVVM and Navigation
- The MVVM Pattern in .NET MAUI Learn MVVM for .NET MAUI: the roles of Model, View and ViewModel, why it beats code-behind, a hand-written ObservableObject and a runnable ViewModel with change notifications, with no UI needed.
- Commands and the MVVM Community Toolkit Handle button taps in MVVM with ICommand, write your own RelayCommand and AsyncRelayCommand, then use CommunityToolkit.Mvvm source generators ObservableProperty and RelayCommand. Includes runnable stand-ins.
- Dependency Injection and View Models Use dependency injection in .NET MAUI: register services, view models and pages in MauiProgram, choose singleton, transient or scoped lifetimes, inject into constructors, and test with fakes.
- Shell Navigation Navigate a .NET MAUI app with Shell: AppShell structure, flyout and tab bar, URI routes, RegisterRoute, GoToAsync with relative and absolute routes, going back, and a runnable route-table stand-in.
- Navigation Parameters, Tabs and Modals Pass data between .NET MAUI pages with query strings, QueryProperty, IQueryAttributable and object parameters; show modal pages, alerts and prompts; and handle tab state, with a runnable query-parser stand-in.
- Loading State, Errors and Async View Models Build robust asynchronous view models in .NET MAUI: IsBusy and view states, loading on appearing, error handling, retry, CancellationToken, the UI thread, and a runnable async view-model stand-in.
Platform Features
- Platform-Specific Code Learn how a .NET MAUI app adapts to Android, iOS, macOS and Windows with DeviceInfo, OnPlatform, conditional compilation, the Platforms folder and partial classes.
- Runtime Permissions Ask for camera, location and storage access correctly in .NET MAUI: manifest entries, Permissions.CheckStatusAsync, RequestAsync, rationale dialogs and denied states.
- Connectivity, Location and Device Sensors Use .NET MAUI Essentials to read network state, get GPS location, listen to the accelerometer, battery and haptics, and learn the patterns for sensor events.
- Camera, Files and Sharing Take photos with MediaPicker, pick files with FilePicker, share text and files, use the clipboard and launch other apps in .NET MAUI, with safe stream handling.
Data and Storage
- Preferences and Secure Storage Store settings with Preferences, secrets with SecureStorage and small objects as JSON in .NET MAUI. Learn what belongs where, with testable wrappers you can run.
- Files and JSON in MAUI Read and write files in a .NET MAUI app with FileSystem.AppDataDirectory, bundle read-only assets, and save objects as JSON with System.Text.Json, atomically and safely.
- SQLite Local Database Add a local SQLite database to a .NET MAUI app with sqlite-net-pcl: models, CreateTableAsync, CRUD, queries, indexes and migrations, plus a runnable repository stand-in.
- Consuming REST APIs Call web APIs from a .NET MAUI app with HttpClient and IHttpClientFactory, parse JSON with System.Text.Json, handle errors, retries and offline cache, and test with a fake handler.
Styling and Resources
- Resources and Styles Centralize colors, fonts and control styles in .NET MAUI with ResourceDictionary, implicit and explicit styles, StaticResource vs DynamicResource, BasedOn, style classes and merged dictionaries.
- Themes and Dark Mode Support light and dark mode in .NET MAUI with AppThemeBinding, RequestedTheme, UserAppTheme and a user theme picker, plus color contrast checks and swappable resource themes.
- Visual States and Triggers Change how .NET MAUI controls look in response to state with VisualStateManager, property, data, event and multi triggers, and learn how to model states in testable C#.
- Fonts, Images and Icons Add custom fonts, SVG and PNG images, the app icon and splash screen to a .NET MAUI app, understand density-independent sizing and font scaling, and pick the right asset format.
- Animations and Custom Handlers Animate .NET MAUI controls with ViewExtensions, Animation objects and easing, then customize native controls with handler mappings; includes runnable easing and animation timeline stand-ins.
Testing and Publishing
- Unit Testing View Models Test .NET MAUI view models without a device using xUnit, fake services, async commands and PropertyChanged assertions; includes a runnable mini test runner you can experiment with.
- Debugging and Diagnostics Debug .NET MAUI apps with breakpoints, Hot Reload, binding error logs, ILogger, crash reports and UI tests; includes runnable logging and exception-handling stand-ins in C#.
- Performance and Startup Make .NET MAUI apps start fast and scroll smoothly: lazy loading, compiled bindings, virtualized lists, image sizing, trimming, AOT and measuring with simple timers and profilers.
- Publishing to the Stores Prepare and publish a .NET MAUI app: app ID and versioning, signing keys, release builds for Android, iOS and Windows, store listings, CI builds and a release checklist with a version bump tool.
Projects and Practice
- Project: Notes App Build a complete notes app in .NET MAUI with MVVM, search, pinning and SQLite storage: project layout, XAML pages, a tested core library and a runnable C# stand-in of the whole app logic.
- Project: Weather App Build a .NET MAUI weather app: call a REST API with HttpClient, parse JSON into models, handle errors and offline use, cache results and show loading states, with a runnable fake-server stand-in.
- Project: Expense Tracker Build a .NET MAUI expense tracker: model money correctly with decimal, group spending by category and month, set budgets, export CSV and draw a simple chart, with runnable C# core logic.
- Practice: Exercises and Interview Questions Practice .NET MAUI with exercises (with runnable C# solutions for the logic parts) and 25 interview questions with concise answers on XAML, binding, MVVM, navigation, platform code and publishing.