August 5th, 2021

Windows Community Toolkit 7.1 Preview Release!

Michael Hawker
Senior Software Engineer

Welcome to Windows Community Toolkit 7.1

We have a lot planned for our upcoming release of the Windows Community Toolkit! We’ve also started separating out more experimental projects that need more time to bake. Check out introductions to some of our new major features coming in this release and the future.

Want to know the best part? You can try them all out today! 🎉

At a Glance – What’s New? 🔍

The Community Toolkit Organization

Community Toolkit Logo

First things first though, we recently renamed our GitHub org to Community Toolkit to envelope the breadth of technologies that our organization now supports. You can read more about this change and our future plans in our last blog post here.

The first step in this journey was we partnered with the Xamarin Community Toolkit team to work with them bringing the MAUI Community Toolkit within our GitHub organization to better align our goals and share resources. You can find all about their plans in their blog post here.

What’s next for the MVVM Toolkit? Source Generators! 🚀

By 🏆 Sergio Pedri

Our upcoming 7.1 release of the MVVM Toolkit will also add support for source generators. This makes the library more flexible, easier to use, and even more efficient!

Following is a small sample of some source generator attributes in action. On the left-hand side is the original hand-written example using the MVVM Toolkit, as you would today. On the right-hand side is how you can use the new attributes to automatically generate the exact same code!

API Comparison

You can already see the impact Source Generators can have saving you from having to write extra “boiler-plate” type code! 🤯

This brand new feature is being developed with the same original core principles of the MVVM Toolkit in mind: being modular and “à la carte”. This means source generator support is bundled with the MVVM Toolkit, but still being completely optional: you’ll be free to use it everywhere, mix & match as needed, or ignore it altogether; it’s entirely up to you! 🙌

Here’s a breakdown of the new features:

  • The [ObservableProperty] attribute creates a super compact way of creating a observable property from just a field and annotation. [AlsoNotifyChangeFor] can also be used to raise a change notifications for another dependent property.
  • The [ICommand] attribute will let you annotate methods in a ViewModel and generate all the corresponding command properties. This includes support for generic commands and asynchronous commands: just annotate an async method returning a Task!
  • You can also annotate a class with [INotifyPropertyChanged], [ObservableObject], [ObservableRecipient], or [ObservableValidator] to inject all the boilerplate code needed to use those MVVM helpers while still inheriting from other base classes! You can also use this to mix together inheriting from ObservableRecipient and then add the [ObservableValidator] attribute to combine all APIs from both classes.

There’s more planned for the future, both in terms of new features and performance improvements!

Microsoft Identity Authentication Helpers, OneDrive Storage, and Microsoft Graph Controls!

By 🏆 Shane Weaver

New and improved for 7.1, the Graph-Controls repo has been overhauled with new helpers and providers for authenticating with Microsoft Identity and calling Graph APIs. We received a lot of great feedback from the community that we hope will help devs hit the ground running, authenticating users, and calling Microsoft Graph APIs!

Also, be sure to check out our ContosoNotes sample which shows how these APIs can be leveraged and create a great experience for users across their applications and devices.

Authentication Providers 🤝

In this release we are introducing a variety of new authentication packages:

Package Description
CommunityToolkit.Authentication Core constructs for supporting authentication aware applications.
CommunityToolkit.Authentication.Msal Authentication provider based on the official Microsoft Authentication Library (MSAL) for .NET SDK.
CommunityToolkit.Authentication.Uwp Authentication provider based on the native account management APIs in Windows.

The MsalProvider available in the *.Msal package is .NET Standard 2.0 and works across multiple systems, use this provider to support cross platform or complex authentication scenarios. For UWP apps, try the WindowsProvider for a lighter weight package.

Graph Powered Controls and OneDrive Helpers

Next we are re-introducing our Graph controls and helpers in the form of two new packages:

Package Description
CommunityToolkit.Graph Extensions and helpers for making adhoc Graph requests, leveraging the official Graph SDK for .NET.
CommunityToolkit.Graph.Uwp Windows specific helpers and controls for facilitating authentication flow and visualizing Graph data.

The *.Graph package includes Graph powered extensions and helpers for interacting with the Graph SDK for .NET and making authenticated requests to Graph APIs:

  • Extensions – Call GetClient() or GetBetaClient() on any IProvider instance to get access to a pre-configured GraphServiceClient on demand.
  • OneDriveStorageHelper and UserExtensionStorageHelper – New helpers for storing settings and file data in Graph based storage locations, such as OneDrive or open extensions on the Graph User object.

Meanwhile, the *.Graph.Uwp package has user controls and helpers for enhancing Graph powered UWP apps:

  • ControlsLoginButton, GraphPresenter, PeoplePicker, and PersonView
  • ProviderStateTrigger – A StateTrigger for detecting when the global authentication provider has been signed in.
  • ElementExtensions.IsVisibleWhen – Extension on FrameworkElement for declaring element visibility behavior in response to authentication changes.

🧪 Introducing Community Toolkit Labs and the Intelligent APIs

As the Windows Community Toolkit has grown, we’ve raised the bar on the quality of our code and the process we use for vetting new features being introduced. This helps our community know they’re getting quality items in each of our releases, but it can slow down the pace that we can innovate at.

Innovation as been the life of the Toolkit. Rapidly prototyping ideas, gathering community feedback, and shipping things folks need has been instrumental to how the Toolkit works. For this reason, we’re introducing “Community Toolkit Labs”.

Labs will be a place where we can incubate and work on new features in a safe space outside our normal code base and ship cycles. It’ll be easier to get started working on code and collaborating with others before having to worry about the docs, samples, and tests required to ship a full fleshed-out idea and feature within the Toolkit.

In the future, we plan to have a central repository for smaller features and controls to be proposed, incubate, and worked in with the community. Be on the lookout for more info about this new experience after our 7.1 release.

We will have a dedicated NuGet feed for Toolkit Labs in our public DevOps package feed. You can find out more about these types of Preview Feeds on our Wiki.

We may also have larger ideas which have their own repository underneath the Labs banner, like the first one we’re introducing today…

Intelligent APIs 🧠

By 🏆 Amrutha Srinivasan

Image Classification Example

“Intelligent APIs” is a project whose goal is to make machine learning easier for developers to leverage in their applications without needing ML expertise! By just importing a NuGet package and calling a function, we want developers to be able to build intelligent app experiences without needing to deal with the complexities of creating and using machine learning models on Windows.

We are currently experimenting with this concept by wrapping two existing state-of-the-art models into NuGet packages. They enable the developer to add image classification and object detection capabilities quickly and easily into their projects with a single function call.

Find out more about how to get started with Intelligent APIs here.

Object Detection Example

And a whole lot more! 😱

If that wasn’t enough we already have more improvements and controls in this preview! And a few more in the works! 😉

📝 Full Release Notes here.

🙋‍♂️ Find out more how to join us and the community in trying out new features and providing feedback in our wiki!

Author

Michael Hawker
Senior Software Engineer

Michael A. Hawker, a.k.a. XAML Llama, is a Senior Software Engineer for the Apps, Partners, and Store (APS) team at Microsoft. APS focuses on driving the ISV ecosystem through technical engagement with partners and industry as well as providing essential first party experiences. Michael is the maintainer of the Windows Community Toolkit and prior “App Ninja”. He is also the creator of XAML Studio, a Microsoft Garage project.

3 comments

Discussion is closed. Login to edit/delete existing comments.

  • Ion Sorin Torjo

    Wow, the ObjectDetection is WOOOOOOOOOOOW !!!!

    By looking at this: https://github.com/CommunityToolkit/Labs-IntelligentAPIs/issues/3 – should I understand that you’re looking into making this work on Windows 10 as well? PLEEASE say YES!!!

    Another question: should I understand that in the future, you’ll bring this to WinUI3 Desktop as well?

    • Michael HawkerMicrosoft employee Author

      We’re using a model from another project, they’re aware of the issue and working to make the model compatible with Win 10, their issue is here.

      Since these aren’t using UI APIs, I believe they should be easier to use directly with WinUI 3 Desktop already, but it’s not something we’ve tested yet. Feel free to open an issue on the repo for tracking.

  • Renee GA

    This is perfect. I was trying to use Source Generators to write MVVM codes. Now I can just use the Community Toolkit.