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

OnTouchEvent override vs Touch += in a renderer

$
0
0

Can somebody comment on what's the difference between the two implementations:

    public override bool OnTouchEvent(MotionEvent e)
    {
        return base.OnTouchEvent(e);
    }

and

    Touch += TouchEvent;
    ...
    void TouchEvent(object sender, Android.Views.View.TouchEventArgs e)
    {
        gd.OnTouchEvent(e.Event);
    }

The thing is that in bare Android project it works pretty much the same. However, when implemented in a renderer it doesn't. It seems like OnTouchEvent method is filtered somehow while TouchEvent still gets all the events.
So I wonder what's going on. I mean I'd expect the former to be a better option (more .net-ish that is).


Viewing all articles
Browse latest Browse all 58056

Trending Articles