maui-gestures
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "maui-gestures" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-27ec14c114467c32ec27d310bc1f03b31cf6cac82218d41177f6673895df88c9. Verify the upstream source and version against https://github.com/davidortinau/maui-skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Guide for implementing gesture recognition in .NET MAUI apps, covering tap, swipe, pan, pinch, drag-and-drop, and pointer gestures, with XAML and C# usage, gesture composition, and platform differences. Suitable for tap, swipe, pan, pinch, drag-and-drop, pointer gestures, gesture recognizers and related recognizers (Tap/Swipe/PanGestureRecognizer). Not for gesture-triggered animations, CollectionView swipe actions, or custom drawing interactions.
Introduction source: third_party · davidortinau · 0.0.1 Reference
SkillPi interpretation
- Tasks
- ⚠️ In .NET 10, `ClickGestureRecognizer` is **deprecated**. Use `TapGestureRecognizer` (touch/stylus) and `PointerGestureRecognizer` (mouse hover/press) instead.
- Testing
- Not tested
Browse files
Frontmatter
name: maui-gestures
description: >
Guidance for implementing tap, swipe, pan, pinch, drag-and-drop, and pointer
gesture recognizers in .NET MAUI applications. Covers XAML and C# usage,
combining gestures, and platform differences.
USE FOR: "tap gesture", "swipe gesture", "pan gesture", "pinch gesture",
"drag and drop", "pointer gesture", "gesture recognizer", "TapGestureRecognizer",
"SwipeGestureRecognizer", "PanGestureRecognizer", "combine gestures".
DO NOT USE FOR: animations triggered by gestures (use maui-animations),
CollectionView swipe actions (use maui-collectionview), or custom drawing interaction (use maui-graphics-drawing)..NET MAUI Gesture Recognizers
Deprecated API Warning
⚠️ In .NET 10,
ClickGestureRecognizeris deprecated. UseTapGestureRecognizer(touch/stylus) andPointerGestureRecognizer(mouse hover/press) instead.
Common Mistakes
One SwipeGestureRecognizer per direction
A single recognizer handles only one direction. Adding multiple directions to one recognizer silently fails on most platforms.
<!-- ❌ Only fires for Left — Right is ignored -->
<SwipeGestureRecognizer Direction="Left,Right" Swiped="OnSwiped" />
<!-- ✅ Separate recognizer per direction -->
<SwipeGestureRecognizer Direction="Left" Swiped="OnSwiped" />
<SwipeGestureRecognizer Direction="Right" Swiped="OnSwiped" />
AllowDrop defaults to false
Drop targets silently ignore drops if you forget this property.
<!-- ❌ Drop never fires — AllowDrop defaults to false -->
<StackLayout>
<StackLayout.GestureRecognizers>
<DropGestureRecognizer Drop="OnDrop" />
</StackLayout.GestureRecognizers>
</StackLayout>
<!-- ✅ Explicitly enable drops -->
<StackLayout>
<StackLayout.GestureRecognizers>
<DropGestureRecognizer AllowDrop="True" Drop="OnDrop" />
</StackLayout.GestureRecognizers>
</StackLayout>
Using TapGestureRecognizer for hover effects
Tap recognizers don't track pointer movement. Use PointerGestureRecognizer
for hover effects — it also enables the PointerOver visual state.
<!-- ❌ No hover tracking — user must tap to trigger -->
<Border>
<Border.GestureRecognizers>
<TapGestureRecognizer Command="{Binding HoverCommand}" />
</Border.GestureRecognizers>
</Border>
<!-- ✅ Proper hover detection + visual state -->
<Border>
<Border.GestureRecognizers>
<PointerGestureRecognizer PointerEnteredCommand="{Binding HoverInCommand}"
PointerExitedCommand="{Binding HoverOutCommand}" />
</Border.GestureRecognizers>
</Border>
Platform Differences That Bite
Pan delta coordinates differ by platform
| Platform | TotalX / TotalY relative to |
|---|---|
| iOS / Mac Catalyst | Start of gesture |
| Android | Previous event (not start!) |
| Windows | Start of gesture |
If sub-pixel accuracy matters, normalize Android deltas by accumulating them
manually rather than using TotalX/TotalY directly.
Pointer hover is mouse/trackpad only
On touch devices, PointerGestureRecognizer events fire on press/release
but hover is not tracked between touches. Don't rely on PointerMoved
for touch-based UI.
Cross-app drag-and-drop
| Platform | Supported |
|---|---|
| iPadOS / Mac Catalyst | ✅ Yes |
| Windows | ✅ Yes |
| Android | ❌ No |
Secondary button (right-click)
| Platform | Behaviour |
|---|---|
| iOS / Mac Catalyst | Buttons = ButtonsMask.Secondary works |
| Windows | Buttons = ButtonsMask.Secondary works |
| Android | Falls back to long-press — no true right-click |
Gesture Combination Conflicts
Combining pan + swipe on the same view conflicts on Android — the swipe may consume the gesture before pan starts. Test on all platforms, or use only one at a time.
Combining tap + pan works well — tap fires on quick taps, pan fires on sustained drags.
MVVM Best Practice
Prefer commands over events for testable view models. Both work identically at runtime, but commands are easier to mock and test.
<!-- ✅ Bindable command — testable -->
<TapGestureRecognizer Command="{Binding TapCommand}" />
<!-- ⚠️ Event handler — requires code-behind, harder to unit-test -->
<TapGestureRecognizer Tapped="OnTapped" />
Quick Rules
- One
SwipeGestureRecognizerper direction PointerGestureRecognizerfor hover, notTapGestureRecognizerAllowDrop="True"on drop targets — it defaults tofalse- Normalize pan deltas on Android (relative to previous event, not start)
- Prefer commands over events for MVVM
- Use
TapGestureRecognizerinstead of deprecatedClickGestureRecognizer(.NET 10) - Don't rely on
PointerMovedfor touch-based UI — hover doesn't track
Current listing version
0.0.1
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 面向.NET MAUI开发者提供全面的手势识别器实现指南
- 涵盖多种常见手势(点击、滑动、平移、捏合、拖放、指针)
- 包含平台差异说明和最佳实践,具有广泛实用价值
Highlights
- 触发词精准完整,覆盖多种变体
- 明确区分适用和不适用场景,边界清晰
Highlights
- 结构清晰,包含常见错误、平台差异、最佳实践等章节
- 提供实用的代码示例和快速规则总结
- frontmatter完整,文档组织良好
Highlights
- 提供了实用的代码示例和平台差异说明
- 指出了常见陷阱和最佳实践,提高执行可靠性
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.