Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Microsoft Releases .NET MAUI Compatibility Packages for the Xamarin Community Toolkit

Microsoft Releases .NET MAUI Compatibility Packages for the Xamarin Community Toolkit

This item in japanese

The Xamarin Community Toolkit is a collection of reusable elements for mobile development with Xamarin.Forms, including animations, behaviors, converters, effects, and helpers. It simplifies and demonstrates common developer tasks when building iOS, Android, macOS, WPF and Universal Windows Platform (UWP) apps using Xamarin.Forms. The Xamarin Community Toolkit is available as a Visual Studio NuGet package for new or existing Xamarin.Forms projects.

As previously announced, .NET MAUI Community Toolkit will replace Xamarin Community Toolkit. In the same way as Xamarin, the Xamarin Community Toolkit is evolving as well, with Xamarin.Forms becoming .NET MAUI. The new Community Toolkit packages for .NET MAUI are available and fully optimized for it. Those new NuGet Packages areCommunityToolkit.Maui and CommunityToolkit.Maui.Markup.

The .NET MAUI Community Toolkit, like the Xamarin Community Toolkit, is completely open-source and supported by the community. The Microsoft team is actively working on migrating functionality from the Xamarin Community Toolkit to the.NET MAUI Community Toolkit, and open-source assistance would be much appreciated. 

CommunityToolkit.Maui and CommunityToolkit.Maui.Markup GitHub repositories are available to explore and contribute to them.

Regarding the backward compatibility and avoiding the breaking changes in the migration, two .NET MAUI-Compatible versions of the Xamarin Community Toolkit were announced back in July and they are now available for usage in the development. Those NuGet packages are Xamarin.CommunityToolkit.MauiCompat and the markup oriented one: Xamarin.CommunityToolkit.Markup.MauiCompat.

These packages are nearly identical to Xamarin Community Toolkit from a feature perspective, but the main difference is the dependency on .NET MAUI, while other parts of the library remain the same. Currently, MauiCompat release supports iOS and Android. But in the future releases will also include support for iOS, Android, macOS and UWP.

There is a common community question: “Which package to use and when?” The answer to that question is provided in the next quote.

Which Apps Should Use MauiCompat? Existing Xamarin.Forms apps migrating to .NET MAUI. The MauiCompat libraries are created as a helpful step in your migration from Xamarin.Forms to .NET MAUI. These libraries ensure that you can access all of the features of Xamarin.CommunityToolkit in your .NET MAUI apps without breaking changes, helping to make your migration to .NET MAUI easier.
We recommend eventually replacing Xamarin.CommunityToolkit.MauiCompat with the new .NET MAUI Toolkit, CommunityToolkit.Maui, to take advantage of new features and optimizations. - Brandon Minnick, Developer Advocate, Developer Relations

Also, for the new .NET MAUI applications, the recommendation is to use CommunityToolkit.Maui since it is a fully-oriented and optimized library for .NET MAUI. 

Regarding the comparison between the Xamarin.CommunityToolkit.MauiCompat vs CommunityToolkit.Maui, future updates to Xamarin.CommunityToolkit.MauiCompact will only bring bug fixes, while CommunityToolkit.Maui will have new features and bug fixes.

Custom Renderers will remain used as a native implementation of Xamarin.CommunityToolkit.MauiCompact; on the other hand, CommunityToolkit.Maui the package will use .NET MAUI Handlers.

Microsoft.Maui.Controls.Compatibility is used in the CommunityToolkit.MauiCompact, and the future roadmap of CommunityToolkit.MauiCompact is depreciation alongside Xamarin.Forms in November this year, while CommunityToolkit.Maui will get regular updates and maintenance releases alongside .NET MAUI. 

Both MauiCompat libraries are available as a NuGet package that can be added to any .NET 6 project targeting net6.0-ios and net6.0-android.

Additional steps to follow in order to convert Xamarin.CommunityToolkit to Xamarin.CommunityToolkit.MauiCompat are provided on the GitHub. More detailed instructions about installation and registration can be found in the DevBlogs article.

Rate this Article