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

ListView with MVVM - TapGestureRecognizer command is not working

$
0
0

I'm using MVVM, I'm finding that trying to detect a row being clicked to invoke a command painful to implement. It would seem that there's no ItemSelected that takes a Command, so I've tried to use the TapGestureRecognizer with no success..
my viewcell is in c# as its bit complex to convert into xaml.

InSide ViewCell---

TapGestureRecognizer taponimgcheckuncheck = new TapGestureRecognizer();
taponimgcheckuncheck.SetBinding(TapGestureRecognizer.CommandProperty,"TapOnLogo");
imgcheckuncheck.GestureRecognizers.Add(taponimgcheckuncheck);

And my viewmodel is like---
public ICommand TapOnLogo{

        get{
            return new Command(() =>
            {
                Application.Current.MainPage.DisplayAlert("TapOnLogo","TapOnLogo","ok");
            });
        }
    }

Viewing all articles
Browse latest Browse all 77050

Trending Articles