.NET MAUI Community Toolkit adds TouchBehavior support

TouchBehavior provides the ability to interact with visual elements in .NET apps based on touch, mouse clicks, and hover events.

digital transformation /finger tap causes waves of interconnected digital ripples

Microsoft has introduced version 8 of the .NET MAUI (Multi-platform App UI) Community Toolkit, featuring TouchBehavior, for interacting with visual elements in an application based on touch, mouse clicks, and hover events.

The update was introduced April 24. Instructions for getting started with the toolkit are available on GitHub.

With the new release, the TouchBehavior implementation enables customization of different visual properties on the VisualElement it is attached to, such as the background color, opacity, scale, and rotation. TouchBehavior also makes it possible to implement long-press touch gestures and enables invoking of code whenever a user presses any visual element in an app. TouchBehavior formerly was known as TouchEffect in the Xamarin Community Toolkit in the Xamarin.Forms app.

The upgraded toolkit also lets users color the Android navigation bar so an app will feel more immersive; the theme is integrated with whatever is seen on the screen. Additionally, users can control whether the navigation bar shows its light content or dark content, pertaining to icons in a light or dark color. This is intended to ensure that the navigation bar matches an app’s style.

The .NET MAUI Community Tookit serves as a community-created library with .NET MAUI extensions, advanced UI/UX controls, and behaviors intended to help developers. .NET MAUI Community Toolkit 8 also comes with some breaking changes:

  • For TouchBehavior, the Community Tookit builders discovered that the binding context was not applied correctly. This applied to all other behaviors in the toolkit and a fix was applied, technically as a breaking change.
  • The implementation of the Snackbar timed alert on Windows was a complete rewrite. Some crashes have been fixed; the Windows app is no longer launching another instance of a Windows app when interacting with a Toast or Snackbar.

For an upcoming edition of the toolkit, plans call for supporting CameraView, which now is being ported from Xamarin to .NET MAUI. This capability will be released as a separate package. Also for the future, improvements are being made to MediaElement to bring deeper integration with the operating system like playing media from the lock screen and showing relevant metadata.

Copyright © 2024 IDG Communications, Inc.