Axemasta.Maui.TouchEffect
1.1.12
See the version list below for details.
dotnet add package Axemasta.Maui.TouchEffect --version 1.1.12
NuGet\Install-Package Axemasta.Maui.TouchEffect -Version 1.1.12
<PackageReference Include="Axemasta.Maui.TouchEffect" Version="1.1.12" />
paket add Axemasta.Maui.TouchEffect --version 1.1.12
#r "nuget: Axemasta.Maui.TouchEffect, 1.1.12"
// Install Axemasta.Maui.TouchEffect as a Cake Addin #addin nuget:?package=Axemasta.Maui.TouchEffect&version=1.1.12 // Install Axemasta.Maui.TouchEffect as a Cake Tool #tool nuget:?package=Axemasta.Maui.TouchEffect&version=1.1.12
This repository has been unarchived and updated to target .NET 9 due to a number of breaking changed over in maui which render
TouchBehavior
not fit for use. The aim is to backport the MCT verion to this library, and then reintroduce it to the MCT. Hopefully when that is done this repository can be archives for good!
Maui.TouchEffect
Maui port of TouchEffect from Xamarin Community Toolkit
The originalaim of this library is to provide temporary support for the touch effect without having to take a dependency on XCT's MauiCompat library. My results of using the compat library have been extremely tempramental, alot of the times the touch effect does not work and due to the packages target framework (net6) & age (2 years old) I figured a new port would be the best option. Currently there is
TouchBehavior
available as part of the maui community toolkit however it is not stable due to a number of maui platform bugs regarding behaviors, and the maui team are unwilling to address these issues.
This library supports the following platforms:
Platform | Supported |
---|---|
iOS | ✅ |
Android | ✅ |
Mac Catalyst | ❌ |
Windows | ❌ |
Tizen | ❌ |
Currently there is only iOS and Android, I plan to port to Mac Catalyst & Windows and also have as much as the code here mirror MCT as possible. At that point I will PR this back into the MCT and see what happens.
Install
Install Maui.TouchEffect package
In your
MauiProgram.cs
, callUseMauiTouchEffect
:var builder = MauiApp.CreateBuilder(); builder .UseMauiApp<App>() ++ .UseMauiTouchEffect() .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); });
Usage
See the samples app from this project, it is a port of the TouchEffectPage
from the XCT samples app.
<img src="assets/Sample_Demonstration.gif" alt="Sample app included with this project" width="500">
Declare xmlns:
xmlns:touch="http://axemasta.com/schemas/2023/toucheffect"
The api has been updated to match the naming conventions seen in MCT, this will help porting between the versions easier
<StackLayout
touch:TouchEffect.AnimationDuration="250"
touch:TouchEffect.AnimationEasing="{x:Static Easing.CubicInOut}"
touch:TouchEffect.Command="{Binding Command, Source={x:Reference Page}}"
touch:TouchEffect.PressedOpacity="0.6"
touch:TouchEffect.PressedScale="0.8"
HorizontalOptions="CenterAndExpand"
Orientation="Horizontal">
<BoxView
HeightRequest="20"
WidthRequest="20"
Color="Gold" />
<Label Text="The entire layout receives touches" />
<BoxView
HeightRequest="20"
WidthRequest="20"
Color="Gold" />
</StackLayout>
Native Animation
I have got this somewhat working again.
iOS
This provides extra opacity & touch feedback, its hard to see the value in this feature currently
Android
This provides ripples on touches. There are some wierd interactions when views have nested TouchEffect
s so be careful when applying them to complicated views.
Acknowlegements
This code is ported from:
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-android35.0 is compatible. net9.0-browser was computed. net9.0-ios was computed. net9.0-ios18.0 is compatible. net9.0-maccatalyst was computed. net9.0-maccatalyst18.0 is compatible. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net9.0-windows10.0.19041 is compatible. |
-
net9.0
- No dependencies.
-
net9.0-android35.0
- No dependencies.
-
net9.0-ios18.0
- No dependencies.
-
net9.0-maccatalyst18.0
- No dependencies.
-
net9.0-windows10.0.19041
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.