Skip to content

WinUI3 - ManipulationStarting Event only occurs on first touch -> e.Container Property is null in following manipulation events #6847

@chrkon

Description

@chrkon

Describe the bug

I want to read the Container Property from the ManipulationEventArgs. But I get a null reference Exception for this property if I touch the Screen a second time.
As a second effect the Touch Position contains an offset. It seems that the Position is relative to the parent control.

Steps to reproduce the bug

  1. create a sample WinUI 3 App with a rectangle as content.
  2. Set manipulationMode = "All" in the code
  3. Add eventhandler for all "Manipulation" events
  4. Write a DebugOutput into each eventhadler.
  5. run the app
  6. do pan or rotate gestures on screen (first time)
  7. do the same a second time
  8. check the debug output

Result:
I use a SwapChainPanel and I have set the manipulation mode property to "All".
The first time I do a pan gesture on the UiElement I receive the following events in this order:

  1. OnManipulationStarting
  2. OnManipulationStarted
  3. OnManipulationDelta ............... (n times)
  4. OnManipulationInertiaStarting
  5. OnManipulationDelta .... (m times)
  6. OnManipulationCompleted

This seems to be OK, but (second tap result!):
If I do this a second time or more often, the "OnManipulationStarting" event handler is not called !
And then the Container Property is null!

Expected behavior

On the second call and on any further calls the OnManipulationStarting event is missing and the Container Property is null!

I would expect the same behaviour as in the first call.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.0

Windows app type

  • UWP
  • Win32

Device form factor

Desktop

Windows version

Windows 11 (21H2): Build 22000

Additional context

If another UIElement gets the focus and the user set the focus back to the swapChainPanel again, the next tap will call the Manipulationstarting event.

It feels like this behaviour mentioned in the WinUI documentation:
https://docs.microsoft.com/en-us/windows/winui/api/microsoft.ui.xaml.uielement.manipulationstarting?view=winui-3.0#windows8-behavior
But I use it on Windows 11!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions