Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

migration version 1.2.3 to 1.3.0 touch event not working nay more when using PageRenderer

$
0
0

Hi ,

In our application we use the code bellow to add gesture listener on a page:
since we move to xamarin.forms version 1.3 event HandleTouch and HandleGenericMotion is not called any more.
if we goback to version 1.2.3 everything work well.

public class CScanPageRenderer : PageRenderer
{
Android.Views.View view;

    private readonly FancyGestureListener _listener;
    private readonly GestureDetector _detector;

    public CScanPageRenderer()
    {
        _listener = new FancyGestureListener();
        _detector = new GestureDetector(_listener);
    }

    protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
    {
        base.OnElementChanged(e);

        var page = e.NewElement as XamlSharedPortable.CScanPage;

        Activity activity = this.Context as Activity;

        var o = activity.LayoutInflater.Inflate(Resource.Layout.ScanPage, this, false);
        view = o;

        this.GenericMotion += HandleGenericMotion;
        this.Touch += HandleTouch;

    }

    void HandleTouch(object sender, TouchEventArgs e)
    {
        _detector.OnTouchEvent(e.Event);
    }

    void HandleGenericMotion(object sender, GenericMotionEventArgs e)
    {
        _detector.OnTouchEvent(e.Event);
    }

Thank for any help.


Viewing all articles
Browse latest Browse all 58056

Trending Articles