AppoMobi.Maui.Gestures
1.0.1.2-pre
See the version list below for details.
dotnet add package AppoMobi.Maui.Gestures --version 1.0.1.2-pre
NuGet\Install-Package AppoMobi.Maui.Gestures -Version 1.0.1.2-pre
<PackageReference Include="AppoMobi.Maui.Gestures" Version="1.0.1.2-pre" />
paket add AppoMobi.Maui.Gestures --version 1.0.1.2-pre
#r "nuget: AppoMobi.Maui.Gestures, 1.0.1.2-pre"
// Install AppoMobi.Maui.Gestures as a Cake Addin #addin nuget:?package=AppoMobi.Maui.Gestures&version=1.0.1.2-pre&prerelease // Install AppoMobi.Maui.Gestures as a Cake Tool #tool nuget:?package=AppoMobi.Maui.Gestures&version=1.0.1.2-pre&prerelease
AppoMobi.Maui.Gestures
Library for .Net MAUI to handle gestures. Can be consumed in Xaml and code-behind.
The current development state is PRE-ALPHA, many features remain to be implemented, the project is active.
This library is used by DrawnUi for .Net Maui for all its gestures.
This readme is heavily under construction, a lot of properties and use cases are not documented.
Features
- Down
- Up
- Tap
- LongPress
- Pan
- Pinch (windows platform missing)
- Rotate (in progress)
Here and there some properties are still missing, but the main functionality is there.
Some points of interest:
- Customizable touch mode
- Report velocity, distance, time, etc
- All data uses pixels on every platform for better precision
The philosophy is to have the more platform agnostic code as possible, by processing platform raw input in a shared code.
Installation
Install the package AppoMobi.Maui.Gestures from NuGet.
After that initialize the library in the MauiProgram.cs file:
builder.UseGestures();
Usage
Getures are handled by a Maui Effect. It attaches itsself if you add one of its key attachable static properties to a control.
Basic Usage
You can just attach properties that would invoke your commands or handlers upon a specific gesture.
Xaml
<Label Text="Hello World!"
touch:TouchEffect.CommandLongPressing="{Binding Source={x:Reference ThisPage}, Path=BindingContext.CommandGoToAnotherPage}"
touch:TouchEffect.CommandTapped="{Binding Source={x:Reference ThisPage}, Path=BindingContext.CommandGoToAnotherPage}"
touch:TouchEffect.CommandTappedParameter="{Binding .}" />
Code behind
TouchEffect.SetCommandTapped(tabItem, TabItemTappedCommand);
TouchEffect.SetCommandTappedParameter(tabItem, selectedIndex);
Enhanced Usage
You can opt for processing gestures on a lower level yourself, especially if you are creating a custom control. First we just attach the effect with a special property:
<draw:Canvas
touch:TouchEffect.ForceAttach="True">
or
TouchEffect.SetForceAttach(myView, true);
Now you need to implement a buil-it interface IGestureListener in your custom control:
public interface IGestureListener
{
public void OnGestureEvent(TouchActionType type, TouchActionEventArgs args, TouchActionResult action);
public bool InputTransparent { get; }
}
As you might guess OnGestureEvent will be invoked on every touch detected if your InputTransparent is not returning True.
Hints
For a case of your custom control sitting inside a ScrollView there is a TouchMode property to be played with. For example you might want to set it to TouchHandlingStyle.Lock so that when your control receives the Down event the parent ScrollView stops receiving gestures until we get an Up, so we can Pan our control at will.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-android33.0 is compatible. net7.0-ios was computed. net7.0-ios16.1 is compatible. net7.0-maccatalyst was computed. net7.0-maccatalyst16.1 is compatible. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net7.0-windows10.0.19041 is compatible. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- AppoMobi.Specials (>= 7.0.0.3)
-
net7.0-android33.0
- AppoMobi.Specials (>= 7.0.0.3)
-
net7.0-ios16.1
- AppoMobi.Specials (>= 7.0.0.3)
-
net7.0-maccatalyst16.1
- AppoMobi.Specials (>= 7.0.0.3)
-
net7.0-windows10.0.19041
- AppoMobi.Specials (>= 7.0.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AppoMobi.Maui.Gestures:
Package | Downloads |
---|---|
AppoMobi.Maui.DrawnUi
Cross-platform rendering engine for .NET MAUI to draw your UI with SkiaSharp |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on AppoMobi.Maui.Gestures:
Repository | Stars |
---|---|
taublast/DrawnUi.Maui
UI Rendering Engine for .NET MAUI powered by SkiaSharp
|
Version | Downloads | Last updated |
---|---|---|
1.9.1.1 | 33 | 11/17/2024 |
1.8.1.2 | 1,094 | 7/14/2024 |
1.2.2.1 | 560 | 5/29/2024 |
1.2.1.1 | 281 | 5/12/2024 |
1.0.8.4 | 391 | 4/3/2024 |
1.0.8.3 | 118 | 4/3/2024 |
1.0.8.2 | 312 | 3/4/2024 |
1.0.5.3 | 1,269 | 1/20/2024 |
1.0.5.2 | 348 | 1/10/2024 |
1.0.5.1 | 236 | 1/10/2024 |
1.0.5 | 263 | 1/7/2024 |
1.0.4.18 | 201 | 1/4/2024 |
1.0.4.10 | 134 | 12/29/2023 |
1.0.4.9 | 116 | 12/29/2023 |
1.0.4.1-pre | 803 | 11/20/2023 |
1.0.3.1-pre | 604 | 10/23/2023 |
1.0.1.3 | 827 | 9/7/2023 |
1.0.1.2-pre | 297 | 6/25/2023 |
1.0.1.1-pre | 132 | 6/17/2023 |
Under construction