Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add PointerPressed and PointerReleased events and commands to PointerGestureRecognizerΒ #13346

@mikeparker104

Description

@mikeparker104

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions