Skip to content

PointerDevice.GetPointerDevice(...) fails for stylus and touch #5387

Open
@MartinRichards23

Description

@MartinRichards23

Describe the bug

Windows.Devices.Input.PointerDevice.GetPointerDevice(e.Pointer.PointerId); works when using mouse input, but fails on my Surface tablet using touch and stylus with message: "The parameter is incorrect. Failed to get pointer information."

This works in UWP, it is blocking for our upgrade to WASDK.

Steps to reproduce the bug

This simple event handler will reproduce the issue:

        private void Grid_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
            try
            {
                PointerDevice d = Windows.Devices.Input.PointerDevice.GetPointerDevice(e.Pointer.PointerId);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }

Expected behavior

I'd expect touch and stylus to work just like mouse does.

Screenshots

Image

NuGet package version

Windows App SDK 1.7.1: 1.7.250401001

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 23H2 (22631, November 2023 Update)

IDE

Visual Studio 2022

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions