Pointer released event doesn't raised as expected

Shay Wilner 1,746 Reputation points
2020-06-29T18:28:38.157+00:00

Hi
in windows form app i have the mouse up event but not in uwp so i try to use the similar event pointer released.
I drag an image and when the mouse button is up i expected the image pointer released event to be raised but this is not
only if i released the mouse and click again the image and release then the event occurs
How to cause the pointer released event raised like the "mouse up event"

Thanks

Universal Windows Platform (UWP)
{count} votes

1 additional answer

Sort by: Most helpful
  1. John Torjo 861 Reputation points
    2020-06-29T18:33:38.887+00:00

    In order to make sure the mouse up event occurs, you need to capture the pointer, like this:

    your_control.CapturePointer(args.Pointer)
    

    On PointerReleased, don't forget to release it:

    your_control.ReleasePointerCapture(args.Pointer)