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

How to access GestureDetector from ViewCellRenderer in .Droid project within Xamarin Form?

$
0
0

[assembly: ExportRenderer (typeof(MySwipeCell), typeof(SwipeCellRenderer))]
namespace TestSwipeListViewWithDelegate.Droid
{
    public class SwipeCellRenderer : ViewCellRenderer
    {
        GestureDetector _gestureDetector;
        GestureListener _gestureListener;
.....
....
    protected override Android.Views.View GetCellCore (Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent,       Android.Content.Context context)
        {
            _gestureListener = new GestureListener();
            _gestureDetector = new GestureDetector(this, _gestureListener);

I have the source code as above, but I received error on gesture detector:
Error message:

Error CS1540: Cannot access protected member Android.Views.GestureDetector.GestureDetector(System.IntPtr, Android.Runtime.JniHandleOwnership)' via a qualifier of typeAndroid.Views.GestureDetector'. The qualifier must be of type `TestSwipeListView.Droid.SwipeCellRenderer' or derived from it (CS1540) (TestSwipeListView.Droid)

Btw, I done try it in a pure android project. It was working fine when I declared the GestureDetector within OnCreate().
No idea how to solve the above issue, anyone?
Any clue?

Thanks,
Jeff


Viewing all articles
Browse latest Browse all 58056

Trending Articles