🚧 📱

Mobile experience coming soon

Mobile development is in progress. Until it is complete, please use your desktop or laptop.

Thanks!

← Back
Gerald Versluis April 15, 2024

Detect Long Press in Your .NET MAUI App with TouchBehavior

Summary

The .NET MAUI Community Toolkit has migrated the TouchEffect feature from Xamarin, introducing the TouchBehavior which allows developers to implement advanced touch interactions like long press gestures across visual elements in .NET MAUI applications. The feature supports multiple platforms including desktop, enabling developers to manipulate element properties such as opacity, rotation, and background color during touch interactions. By utilizing the toolkit's touch behavior, developers can easily add sophisticated touch-based interactions like context menus, multi-selection, and page navigation through long press commands and events. The implementation is straightforward, requiring NuGet package installation and a simple XML namespace configuration in XAML to enable these rich touch interaction capabilities.

View original episode ↗