What's new with the latest release of .NET Community Toolkit

Preview 3 of version 8 of the .NET Community Toolkit just dropped and it comes packed with a ton of goodies. For those unfamiliar with what this is, it a set of APIs and helpers to assist .NET developers with a large number common tasks regardless of the UI platform they chose to build with. Today we are going to dig into a couple of new features headed our way, let's get to it.

Microsoft MVVM Toolkit

This new MVVM Toolkit version expands on the source generator functionality released in previous releases. These APIs are intended to significantly simplify the necessary boilerplate when dealing with MVVM, with help ranging from observable properties to commands and more. Here are some of the features.

Cancellation support for commands

The [ICommand] attribute now contains a new property that can be used to direct the source generator to generate a cancel command in addition to the original command. This cancel command can be used to stop an asynchronous command from running. Check out the example implementation below.

[ICommand(IncludeCancelCommand = true)]
private async Task DoWorkAsync(CancellationToken token)
{
    // Do some long running work with cancellation support
}

Revamped observable grouped collections

These APIs are especially handy for working with grouped items, and they now feature improvements to substantially simplify basic tasks such as adding an item in the correct location within a group. Starting with this release all the observable grouped collection types from the CommunityToolkit.Common moved to to CommunityToolkit.Mvvm. Sergio Pedri Software Engineer II at Microsoft shows us a sample of this in the GIF below.

mvvm_toolkit_collections

This was just a glimpse at the changes coming our way with the latest Preview release of the Community Toolkit. As always be sure to watch out for breaking changes, as some are in fact included.

For more details on what we just discussed here plus more information on other improvements, please visit the original blog post here or check out the official Community Toolkit's Github repository for a more comprehensive view of all new features and changes.

Share This Post:

Older

Former Microsoft Corporate Vice President for Commercial Partner Gavriella Schuster joins Nerdio board of directors

What's new in TypeScript 4.7 Beta

Newer