.NET MAUI Community Toolkit 5.1.0: Lazy View and Keyboard Extensions

MMS Founder
MMS Edin Kapic

Article originally posted on InfoQ. Visit InfoQ

The latest release of the .NET MAUI Community toolkit, version 5.1.0, brings two main features and several bug fixes for the last version.

One of the features is the reintroduction of the LazyView control, which is ported from the Xamarin Community Toolkit. LazyView allows the developers to delay the initialization of a MAUI view until it’s absolutely needed. To do so, LazyView control has a LoadViewAsync method. There is a HasLazyViewLoaded property that returns the status of the loading of the LazyView. The documentation and the sample application are updated to reflect the new feature.

Another significant addition is the addition of the keyboard extensions. These are a set of extension methods that support interacting with the soft keyboard on the UI controls that support text input.

There are two extension methods called ShowKeyboardAsync and HideKeyboardAsync, that show and hide the soft keyboard, respectively. One additional property, IsSoftKeyboardShowing, returns the soft keyboard visibility status. These extensions can be found under the CommunityToolkit.Maui.Core.Extensions namespace.

Gerald Versluis, the developer from Microsoft who released the 5.1.0 version of the toolkit, uploaded a video that shows how to fix the keyboard overlapping problem in .NET MAUI applications. The video has attracted a lot of comments from the developers.

The release notes for version 5.1.0 of the toolkit also mention several bug fixes regarding the FileSaver component bugs:

  • The component didn’t truncate existing files on writing over them. It meant that junk data was visible at the end of the overwritten file if the newly written data was shorter than in the previously existing file.
  • In the case of saving non-seekable streams, such as web download streams, the FileSaver component method SaveAsync would fail.
  • On the Apple Mac platform, the component would ignore the provided file name in the ‘Save As’ text box, using a random GUID as the filename.
  • Saving a file without an extension would result in a cryptic error message: 'The parameter is incorrect'.

A minor fix has been added to the FolderPicker component. Previously, on some Android devices, the folder picker would give a ‘No application can perform this operation’ error message. The underlying bug was related to the component specifying an intent chooser for the folder picker. This code was removed from the implementation.

This version also includes updates to several dependencies, namely Newtonsoft.Json and Microsoft.Extensions.Http.Polly libraries.

In addition, developers interested in tracking the .NET MAUI Community Toolkit project’s roadmap and general progress can find detailed information on the official GitHub repository.

About the Author

Subscribe for MMS Newsletter

By signing up, you will receive updates about our latest information.

  • This field is for validation purposes and should be left unchanged.