Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions docs/fundamentals/gestures/pointer.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Recognize a pointer gesture"
description: "Learn how to use the PointerGestureRecognizer class, to detect when the pointer enters, exits, and moves within a view on iPadOS, Mac Catalyst, and Windows."
ms.date: 10/02/2023
ms.date: 10/16/2023
---

# Recognize a pointer gesture
Expand Down Expand Up @@ -44,6 +44,8 @@ The <xref:Microsoft.Maui.Controls.PointerGestureRecognizer> class also defines t
- <xref:Microsoft.Maui.Controls.PointerGestureRecognizer.PointerExited>, that's raised when the pointer that's in the view's bounding area leaves that bounding area.
- <xref:Microsoft.Maui.Controls.PointerGestureRecognizer.PointerMoved>, that's raised when the pointer moves while remaining within the bounding area of the view.

A <xref:Microsoft.Maui.Controls.PointerEventArgs> object accompanies the events, and defines a `GetPosition` method that returns a `Point?` object that represents the position of the pointer when the gesture was detected. For more information about the `GetPosition` method, see [Get the gesture position](#get-the-gesture-position).

::: moniker-end

::: moniker range=">=net-maui-8.0"
Expand All @@ -54,12 +56,24 @@ The <xref:Microsoft.Maui.Controls.PointerGestureRecognizer> class also defines t
- `PointerPressed`, that's raised when the pointer initiates a press within the view.
- `PointerReleased`, that's raised when the pointer that has previously initiated a press is released, while within the view.

::: moniker-end
A <xref:Microsoft.Maui.Controls.PointerEventArgs> object accompanies the events, and defines a `PlatformArgs` property of type `PlatformPointerEventArgs` that provides access to platform-specific arguments for the event. The `PlatformPointerEventArgs` class defines the following properties:

- Android:
- `Sender`, of type <xref:Android.Views.View>, represents the native view attached to the event.
- `MotionEvent`, of type <xref:Android.Views.MotionEvent>, indicates the native event or handler attached to the view.
- iOS/Mac Catalyst:
- `Sender`, of type <xref:UIKit.UIView>, represents the native view attached to the event.
- `GestureRecognizer`, of type <xref:UIKit.UIGestureRecognizer>, indicates the native event or handler attached to the view.
- Windows:
- `Sender`, of type <xref:Microsoft.UI.Xaml.FrameworkElement>, represents the native view attached to the event.
- `PointerRoutedEventArgs`, of type <xref:Microsoft.UI.Xaml.Input.PointerRoutedEventArgs>, indicates the native event or handler attached to the view.

A <xref:Microsoft.Maui.Controls.PointerEventArgs> object accompanies all three events, and defines a `GetPosition` method that returns a `Point?` object that represents the position of the pointer when the gesture was detected. For more information about the `GetPosition` method, see [Get the gesture position](#get-the-gesture-position).
In addition, the <xref:Microsoft.Maui.Controls.PointerEventArgs> object defines a `GetPosition` method that returns a `Point?` object that represents the position of the pointer when the gesture was detected. For more information about the `GetPosition` method, see [Get the gesture position](#get-the-gesture-position).

::: moniker-end

> [!IMPORTANT]
> Pointer gesture recognition is only supported on iPadOS, Mac Catalyst, and Windows.
> Pointer gesture recognition is supported on Android, iPadOS, Mac Catalyst, and Windows.

.NET MAUI also defines a `PointerOver` visual state. This state can change the visual appearance of a view when it has a mouse cursor hovering over it, but isn't pressed. For more information, see [Visual states](~/user-interface/visual-states.md).

Expand Down
2 changes: 1 addition & 1 deletion docs/whats-new/dotnet-8.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ For information about what's new in .NET 8, see [What's new in .NET 8](/dotnet/c
- <xref:Microsoft.Maui.Controls.Grid> gains an `AddWithSpan` extension method that adds a view to the `Grid` at the specified row and column with the specified row and column spans.
- On iOS, `MauiUIApplicationDelegate` gains a `PerformFetch` method that can be overridden or consumed via the `iOSLifecycle.PerformFetch` delegate. For more information, see [iOS platform lifecycle events](~/fundamentals/app-lifecycle.md#ios).
- The <xref:Microsoft.Maui.Controls.TapGestureRecognizer> class gains the ability to handle secondary taps on Android. For more information, see [Recognize a tap gesture](~/fundamentals/gestures/tap.md).
- Some of the common properties from the <xref:Microsoft.Maui.Controls.Editor>, <xref:Microsoft.Maui.Controls.Entry>, and <xref:Microsoft.Maui.Controls.SearchBar> controls have moved to the base <xref:Microsoft.Maui.Controls.InputView> class. For more information, see [Editor](~/user-interface/controls/editor.md), [Entry](~/user-interface/controls/entry.md), and [SearchBar](~/user-interface/controls/searchbar.md).
- The <xref:Microsoft.Maui.Controls.PointerEventArgs> object that accompanies the pointer events raised by the <xref:Microsoft.Maui.Controls.PointerGestureRecognizer> class gains a `PlatformArgs` property of type `PlatformPointerEventArgs`. This property provides access to the platform-specific arguments for a pointer gesture event. For more information, see [Recognize a pointer gesture](~/fundamentals/gestures/pointer.md).

The following types or members have been deprecated:

Expand Down