none
[W10M][UWP] How to use Touch Information? RRS feed

  • Question

  • Hi

    I try convert WP8.1Silverlight App to UWP App for Windows 10

    But Touch Class is can't convert.

    I want to get some touch action type and position and touch event.

    How to get Touch Information?

    Please let me know.

    Thanks.

    Jack.


    Thursday, July 14, 2016 9:13 AM

Answers

  • Hi jack.hong,

    Tap, Press and hold, Slide, Swipe, Turn, Pinch and Stretch touch gestures supported by the UWP.

    Also there are a lot of Gesture events in UWP. For the Pointer there are several Pointer events in UWP, such as PointerPressed, PointerReleased, PointerMoved, PointerEntered, PointerExited, PointerCanceled, PointerCaptureLost, PointerWheelChanged and PointerRoutedEventArgs.

    For more info, see Touch interactions.

    >>How to get Touch Information?

    Such as the PointerPressed event, we can get the position by use the PointerRoutedEventArgs.GetCurrentPoint.

    For example:

    private void MyGrid_PointerPressed(object sender, PointerRoutedEventArgs e)
    {
        var a = e.GetCurrentPoint(this);
        var X = a.Position.X.ToString();
        var Y = a.Position.Y.ToString();
    }

    Best Regards,

    Jayden Gu

    • Proposed as answer by Jayden Gu Wednesday, July 20, 2016 9:16 AM
    • Marked as answer by jack.hong Thursday, July 21, 2016 11:30 AM
    Monday, July 18, 2016 1:19 AM

All replies

  • Hi jack.hong,

    Tap, Press and hold, Slide, Swipe, Turn, Pinch and Stretch touch gestures supported by the UWP.

    Also there are a lot of Gesture events in UWP. For the Pointer there are several Pointer events in UWP, such as PointerPressed, PointerReleased, PointerMoved, PointerEntered, PointerExited, PointerCanceled, PointerCaptureLost, PointerWheelChanged and PointerRoutedEventArgs.

    For more info, see Touch interactions.

    >>How to get Touch Information?

    Such as the PointerPressed event, we can get the position by use the PointerRoutedEventArgs.GetCurrentPoint.

    For example:

    private void MyGrid_PointerPressed(object sender, PointerRoutedEventArgs e)
    {
        var a = e.GetCurrentPoint(this);
        var X = a.Position.X.ToString();
        var Y = a.Position.Y.ToString();
    }

    Best Regards,

    Jayden Gu

    • Proposed as answer by Jayden Gu Wednesday, July 20, 2016 9:16 AM
    • Marked as answer by jack.hong Thursday, July 21, 2016 11:30 AM
    Monday, July 18, 2016 1:19 AM
  • Thanks Jayden.
    Thursday, July 21, 2016 11:30 AM