BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News .NET MAUI Community Kit 1.3 Released

.NET MAUI Community Kit 1.3 Released

On October 4th 2022, Microsoft released version 1.3 of the .NET MAUI Community Toolkit, a library of valuable additions to the official MAUI application framework. This release includes bug fixes and several enhancements such as gravatar support, a coloured status bar, and fade animation for controls.

.NET MAUI Community Toolkit (NMCT) is one of Microsoft’s .NET community toolkits hosted on GitHub. Their purpose is to let the community contribute useful code missing in the official frameworks. The community toolkits are released as open-source software and they encourage the developers to submit their contributions.

The first version of NCMT was launched in July 2021 as a replacement for the existing Xamaring Community Toolkit. Version 1.3 is the third enhanced version after the general availability of NCMT in March this year.

Two of the toolkit improvements have been implemented as behaviours, a design decision in the MAUI framework to allow developers to add functionality to the existing user interface controls without having to subclass them and use the extended classes.

The coloured status bar is a new behaviour class called StatusBarBehavior. It allows the developer to add it to a collection of page behaviours, specifying the status bar colour and style (whether it is dark or light content).

<ContentPage.Behaviors>
    <toolkit:StatusBarBehavior StatusBarColor="Fuchsia" StatusBarStyle="LightContent" />
</ContentPage.Behaviors>

If the developers are targeting the iOS platform, a small change in the Info.plist metadata file to support this feature.

Fade animation is added to the existing AnimationBehavior class. It allows the developer to animate the opacity of a visual UI element from its original opacity to a specified opacity level and back.

The source code for this animation looks like this:

<Button Text="Click this Button">
    <Button.Behaviors>
        <toolkit:AnimationBehavior EventName="Clicked">
            <toolkit:AnimationBehavior.AnimationType>
                <toolkit:FadeAnimation Opacity="0.2"/>
            </toolkit:AnimationBehavior.AnimationType>
        </toolkit:AnimationBehavior>
    </Button.Behaviors>
</Button>

A Gravatar image source allows developers to leverage an existing Gravatar for the user profile. It is implemented as a specialized image source class called GravatarImageSource, where the Email property specifies the user profile.

<Image>
    <Image.Source>
        <toolkit:GravatarImageSource
            CacheValidity="1"
            CachingEnabled="True"
            Email="youremail@here.com"
            Image="MysteryPerson" />
    </Image.Source>
</Image>

There are additional properties in the image source that further refine the cache lifecycle of the gravatar or provide a default image if no gravatar can be found.

One minor enhancement in this version is the availability of SourceLink debugging symbols for Microsoft’s community toolkits. SourceLink allows Visual Studio to download source code and debugging metadata for NuGet packages. The developer, while debugging the code that uses the library, can step into the library implementation itself.

The newly added features are already available in the sample application for NMCT, also hosted on GitHub.

MAUI (Multi-application user interface) framework is the newest Microsoft framework for cross-platform application development, replacing Xamarin and Xamarin Forms. It was officially released in August 2022.

About the Author

Rate this Article

Adoption
Style

BT