Skip to content

Add PointerPressed and PointerReleased events and commands to PointerGestureRecognizer #13346

Description

Description

Add support for PointerPressed and PointerReleased events/commands alongside the existing PointerEntered, PointerMoved, and PointerExited events/commands to simplify and enable a broader set of scenarios with a single GestureRecognizer.

Public API Changes

public static readonly BindableProperty PointerPressedCommandProperty = BindableProperty.Create(
    nameof(PointerPressedCommand), 
    typeof(ICommand), 
    typeof(PointerGestureRecognizer), 
    null);

public static readonly BindableProperty PointerPressedCommandParameterProperty = BindableProperty.Create(
    nameof(PointerPressedCommandParameter), 
    typeof(object), 
    typeof(PointerGestureRecognizer), null);

public static readonly BindableProperty PointerReleasedCommandProperty = BindableProperty.Create(
    nameof(PointerReleasedCommand), 
    typeof(ICommand), 
    typeof(PointerGestureRecognizer), 
    null);

public static readonly BindableProperty PointerReleasedCommandParameterProperty = BindableProperty.Create(
    nameof(PointerReleasedCommandParameter), 
    typeof(object), 
    typeof(PointerGestureRecognizer), 
    null);

public event EventHandler<PointerEventArgs>? PointerPressed;

public event EventHandler<PointerEventArgs>? PointerReleased;

public ICommand PointerPressedCommand
{
    get { return (ICommand)GetValue(PointerPressedCommandProperty); }
    set { SetValue(PointerPresssedCommandProperty, value); }
}

public ICommand PointerPressedCommandParameter
{
    get { return (ICommand)GetValue(PointerPressedCommandParameterProperty); }
    set { SetValue(PointerPressedCommandParameterProperty, value); }
}

public ICommand PointerReleasedCommand
{
    get { return (ICommand)GetValue(PointerReleasedCommandProperty); }
    set { SetValue(PointerReleasedCommandProperty, value); }
}

public ICommand PointerReleasedCommandParameter
{
    get { return (ICommand)GetValue(PointerReleasedCommandParameterProperty); }
    set { SetValue(PointerReleasedCommandParameterProperty, value); }
}

Intended Use-Case

Support things like drag, resize, etc. without having to coordinate with other gesture recognizers and/or hook into native platform pointer events / gesture recognisers.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

area-gesturesGesture typesfixed-in-8.0.0-rc.1.9171Look for this fix in 8.0.0-rc.1.9171fixed-in-8.0.6Look for this fix in 8.0.6 SR1!partnerIssue or Request from a partner teampartner/cat 😻this is an issue that impacts one of our partners or a customer our advisory team is engaged withproposal/acceptedt/enhancement ☀️New feature or request

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions