Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Swipe Detector trying to be implemented on CollectionView with many ViewCells

$
0
0

My attempt to get the swipe gesture to register currently looks like this. I would love for a swipe anywhere on the collection view to register. Right now my events aren't even registering. In debug mode my program never enters into the methods to handle the swipe events.

` UISwipeGestureRecognizer swipeRightRecognize = new UISwipeGestureRecognizer(this.SwipeRight);
swipeRightRecognize.Direction = UISwipeGestureRecognizerDirection.Right;
collectionView.AddGestureRecognizer(swipeRightRecognize);

        UISwipeGestureRecognizer swipeLeftRecognize = new UISwipeGestureRecognizer(this.SwipeLeft);
        swipeLeftRecognize.Direction = UISwipeGestureRecognizerDirection.Right;
        collectionView.AddGestureRecognizer(swipeLeftRecognize);`

` public void SwipeRight()
{
//UISwipeGestureRecognizer SwipeGestureRecognizer = new UISwipeGestureRecognizer();
var x = 0;
//SwipeGestureRecognizer.AddTarget(() => this.SwipeHandler(SwipeGestureRecognizer));
//this.collectionView.AddGestureRecognizer(SwipeGestureRecognizer);

    }
    public void SwipeLeft()
    {
        var x = 0;
    }`

My only guess is that it isn't registering because the swipes are occurring on the ViewCells in the collectionView. So if that is the case how do I create an event to handle that? I haven't been able to find anything to guide me in the right direction with this.


Viewing all articles
Browse latest Browse all 204402