locked
How to use GestureRecognizer on Windows Phone 8.1 Silverlight? RRS feed

  • Question

  • The problem is, that in order to generate manipulations, GestureRecognizer requires to call its methods "ProcessXXX" (e.g. "ProcessDownEvent").

    These methods require "PointerPoint" object.

    On winrt I got this point directly from "PointerXXX" event args (e.g. "args.GetCurrentPoint"). However, I don't have this in Windows Phone.

    Calling static method PointerPoint.GetCurrentPoint throws exception.

    So, my question is: how I can make GestureRecognizer to work on Windows Phone 8.1 Silverlight?

    Thanks


    Tuesday, June 17, 2014 3:57 PM

Answers

  • You can wire up the CoreWindow.PointerPressed (&c) in a Silverlight 8.1 app to get the pointer messages to pass on to the GestureRecognizer.

    PointerPoint.GetCurrentPoint should work if you pass a valid pointerID, but it isn't used with the GestureRecognizer.

    --Rob

    Tuesday, June 17, 2014 8:17 PM

All replies

  • You can wire up the CoreWindow.PointerPressed (&c) in a Silverlight 8.1 app to get the pointer messages to pass on to the GestureRecognizer.

    PointerPoint.GetCurrentPoint should work if you pass a valid pointerID, but it isn't used with the GestureRecognizer.

    --Rob

    Tuesday, June 17, 2014 8:17 PM
  • Didn't knew about availability of CoreWindow for WP...

    I think that will solve my problem.

    Many thanks!

    Wednesday, June 18, 2014 4:39 AM
  • Hi Rob,

    I tried to implement using CoreWindow, but for some reason PointerXXX events are not being fired. Do I miss something?

    Here what I tried to do:

    public MainPage()
            {
                InitializeComponent();

                var w = CoreWindow.GetForCurrentThread();

                w.PointerPressed += MainPage_PointerPressed;
            }

    void MainPage_PointerPressed(CoreWindow sender, PointerEventArgs args)
            {
                //never fired
            }

    Wednesday, June 18, 2014 7:29 AM