Preview 3 of .NET Community Toolkit version 8 just dropped and it comes with a ton of goodies. For those who don’t know what it is, it’s a set of APIs and wizards to help .NET developers with a lot of common tasks, regardless of platform. user interface they chose to create with. Today we are going to explore some new features that are waiting for us, let’s go.
Microsoft MVVM Toolkit
This new version of MVVM Toolkit extends the source generator functionality released in previous versions. These APIs are intended to greatly simplify the boilerplate needed when dealing with MVVM, with help ranging from observable properties to commands and more. Here are some of the features.
Support for canceling orders
the [ICommand] The attribute now contains a new property that can be used to instruct the source builder to generate an undo command in addition to the original command. This cancel command can be used to stop the execution of an asynchronous command. Check out the sample implementation below.
[ICommand(IncludeCancelCommand = true)]
private async Task DoWorkAsync(CancellationToken token)
// Do some long running work with cancellation support
Revamped Observable Clustered Collections
These APIs are especially handy for working with grouped items, and they now feature enhancements to greatly simplify basic tasks such as adding an item to the correct location within a group. Starting with this release, all observable grouped collection types from CommunityToolkit.Common have been moved to CommunityToolkit.Mvvm. Sergio Pedri Software Engineer II at Microsoft shows us an example in the GIF below.
This was just a preview of the changes coming with the latest Community Toolkit Preview. As always, be sure to pay attention to breaking changes, as some are actually included.
For more details on what we just discussed here and more information on other improvements, please visit the original blog post here or check out the official Community Toolkit Github repository for a more complete view of all the new features and changes.
Share this post: