loading experience

.NET MAUI

.NET MAUI in .NET 10: quality, compiled XAML and deprecated controls

What changes in version 10 for developers building Android, iOS, Windows and macOS apps with .NET MAUI.

.NET MAUI in .NET 10: quality, compiled XAML and deprecated controls

.NET MAUI lets you write a single C# and XAML application for Android, iOS, macOS and Windows, using each platform's native controls. In .NET 10 the work focused on quality, performance and API clean-up.

Deprecation warnings are the list of things to update.
Deprecation warnings are the list of things to update.

XAML generated at compile time

The XAML source generator turns pages into C# code during compilation, instead of interpreting them at startup. Markup errors show up earlier and pages open faster.

<PropertyGroup>
  <MauiXamlInflator>SourceGen</MauiXamlInflator>
</PropertyGroup>

Deprecated controls and APIs

  • ListView and TableView are deprecated: CollectionView is the control to use for lists.
  • MessagingCenter is no longer public: use the CommunityToolkit's WeakReferenceMessenger.
  • Application.MainPage gives way to overriding CreateWindow.
public partial class App : Application
{
    public App() => InitializeComponent();

    protected override Window CreateWindow(IActivationState? activationState) =>
        new(new AppShell());
}

Other improvements

  • Finer control of safe areas (notches, system bars) for each edge of the screen.
  • Multiple selection of photos and videos in the media picker.
  • Improved interoperability between C# and JavaScript in HybridWebView.
  • Support for the latest Android and iOS versions.

How to upgrade

Change the target frameworks to net10.0-android, net10.0-ios and so on, update the workloads with dotnet workload update and tackle the deprecation warnings first: they are the list of things to fix before they become errors.

Comments (0)

No comments yet.

Leave a comment