Repository navigation
Closed
Labels
Milestone
Description
Description
The GestureRecognizers are lacking. Can we add LongPressGestureRecognizer to aid with more possibilities of choices/options in UI? LongPressGestureRecognizer already works in xamarin and I think would be a great and necessary addition in MAUI.
Public API Changes
Copy paste from xamarin proposal
public class LongPressGestureRecognizer : GestureRecognizer
{
public static readonly BindableProperty IsLongPressingProperty;
public bool IsLongPressing { get; set; }
public ICommand FinishedCommand { get; set; }
public object FinishedCommandParameter { get; set; }
// Bindable Property will live on GestureRecognizer
public ICommand CancelledCommand { get; set; }
public object CancelledCommandParameter { get; set; }
// Bindable Property will live on GestureRecognizer
public ICommand StartedCommand { get; set; }
public object StartedCommandParameter { get; set; }
public static readonly BindableProperty NumberOfTouchesRequiredProperty;
public int NumberOfTouchesRequired { get; set;}
public static readonly BindableProperty NumberOfTapsRequiredProperty;
public int NumberOfTapsRequired { get; set; }
public static readonly BindableProperty MinimumPressDurationProperty;
public double MinimumPressDuration { get; set; }
public static readonly BindableProperty AllowableMovementProperty;
public uint AllowableMovement { get; set; }
public event EventHandler LongPressed;
public event EventHandler<LongPressUpdatedEventArgs> LongPressUpdated;
}
Intended Use-Case
Used in xaml to add gestures to the UI. Example:
<Frame.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Path=BindingContext.OpenEventCommand, Source={x:Reference Name=Main}}" CommandParameter="{Binding}" NumberOfTapsRequired="2" />
<LongPressGestureRecognizer Command="{Binding Path=BindingContext.OpenMenuCommand, Source={x:Reference Name=Main}}" CommandParameter="{Binding}" />
</Frame.GestureRecognizers>
In this case, we could do more things based on the gestures
Reacted by sjordanGSS, JkPersson, Rodrigo Diaz, Marc Mognol, Marvin E, Elias Olofsson, Vladimir, Vroomer, camp, KlaasTroost and 11 more
Activity
v-croft commentedon Sep 3, 2022
Please could this feature be added?
Juansero29 commentedon Dec 15, 2022
Seems like CommunityToolkit will implement this feature, can be tracked with this issue: CommunityToolkit/Maui#86
feat: Add LongPressGestureRecognizer core API (Phase 1)
feat: Add iOS/MacCatalyst implementation for LongPressGestureRecogniz…
feat: Add Android implementation for LongPressGestureRecognizer (Phas…
11 remaining items
feat: Add Android implementation for LongPressGestureRecognizer (Phas…
feat: Add LongPressGestureRecognizer core API (Phase 1)
feat: Add iOS/MacCatalyst implementation for LongPressGestureRecogniz…
feat: Add Android implementation for LongPressGestureRecognizer (Phas…
feat: Add LongPressGestureRecognizer core API (Phase 1)
feat: Add iOS/MacCatalyst implementation for LongPressGestureRecogniz…
feat: Add Android implementation for LongPressGestureRecognizer (Phas…
Add LongPressGestureRecognizer for .NET MAUI 11 (#33432)
jfversluis commentedon Mar 17, 2026
Implemented for .NET 11 in #33432. Will be released as part of .NET 11 preview 3. Please try it out early and provide us with the feedback so we can make sure it's solid by GA in November. Thanks!
jeremy-visionaid commentedon Mar 25, 2026
@jfversluis Thanks for this! I implemented my own some time ago and found that there were various upstream problems preventing multi-contact long press from working in WinUI:
microsoft/microsoft-ui-xaml#10687
microsoft/microsoft-ui-xaml#10924
Maybe you have some clout to poke people at MS for getting those things fixed and then we could bring the Windows one up to parity with the others?
jfversluis commentedon Mar 25, 2026
@jeremy-visionaid Thanks! Please test this early if you can and let us know so we can improve before GA and it's as solid as possible :)
For the Windows issues, I'll see what I can do. I can imagine touch is less of a priority to them.