Advertisement
Intermediate .NET MAUI, Migration from Xamarin.Forms

How do namespaces and using directives change from Xamarin.Forms to MAUI?

Short answer

Xamarin.Forms types move to Microsoft.Maui and Microsoft.Maui.Controls. Xamarin.Essentials merges into Microsoft.Maui.* namespaces. Update using directives and XAML namespace declarations (the default xmlns changes to the MAUI schema). Global usings can reduce repetitive imports.

Save .NET MAUI mock interview
Advertisement
AModel answer
Xamarin.Forms types move to Microsoft.Maui and Microsoft.Maui.Controls. Xamarin.Essentials merges into Microsoft.Maui.* namespaces. Update using directives and XAML namespace declarations (the default xmlns changes to the MAUI schema). Global usings can reduce repetitive imports.
// Xamarin.Forms
using Xamarin.Forms;
// MAUI
using Microsoft.Maui;
using Microsoft.Maui.Controls;
Real-world example
A migration sweeps the codebase replacing Xamarin.Forms usings with Microsoft.Maui equivalents and updates the XAML root xmlns.
Likely follow-ups
  • Where did Xamarin.Essentials go? | What is the new XAML xmlns?
Related topics