title: TapGestureRecognizer not working inside ListView
body: <p>I am working on a Xamarin.Forms page displaying a list of items using MVVM pattern.</p>
  
  <p>I can not get the Command property of the TapGestureRecognizer object of the list items working. It does not even fire, no matter what I try.
  This command property should reference a single ICommand property on the VM for all the listview elements. The CommandParameter property should select between the elements based on their Id.</p>
  
  <p>The Tapped event seems to be working. I am not sure whether my databinding of the Command property to the VM is faulty or Xamarin.Forms has a bug here.</p>
  
  <p>I have tried different settings for the data binding of TapGestureRecognizer's Command property to my ViewModel and I have also played with the InputTransparent properties on the nested View-elements. No change here: Command does not fire</p>
  
  <p>View XAML header:</p>
  
  <pre><code>&lt;ContentPage ...
               x:Class="Ch9.MainPage2"
               x:Name="page"
               &gt;
  </code></pre>
  
  <p>View has a ViewModel property which is the viewmodel:</p>
  
  <pre><code>public partial class MainPage2 : ContentPage
  {
      public MainPage2ViewModel ViewModel
      {
         get =&gt; BindingContext as MainPage2ViewModel;
         set =&gt; BindingContext = value;
      }
  
          public MainPage2()
          {
              InitializeComponent();
              ViewModel = new MainPage2ViewModel(
              ...injecting components...
               );
          }
  }
  </code></pre>
  
  <p>the viewmodel has an ItemTappedCommand property:</p>
  
  <pre><code>public ICommand ItemTappedCommand { get; private set; }
  ...
  ItemTappedCommand = new Command&lt;int&gt;(async id =&gt; await OnItemTappedCommand(id));
  </code></pre>
  
  <p>Inside the page I have a stacklayout as content-root and inside the stacklayout there is a listview. To keep the code small, I have omitted what I could, what I think is not relevant</p>
  
  <pre><code>&lt;ListView
      ItemsSource="{Binding SearchResults}"&gt;
      &lt;ListView.ItemTemplate&gt;
      &lt;DataTemplate&gt;                        
          &lt;ViewCell&gt;
              &lt;StackLayout&gt;
                  &lt;StackLayout.GestureRecognizers&gt;
                        &lt;TapGestureRecognizer 
                              BindingContext="{x:Reference page}"                                        
                              Command="{Binding Path=ViewModel.ItemTappedCommand}" CommandParameter="{Binding Id}"  NumberOfTapsRequired="1"/&gt;
                  &lt;/StackLayout.GestureRecognizers&gt;
  
                                  &lt;Image InputTransparent="True"&gt;
                                      &lt;Image.Source&gt;
                                          &lt;UriImageSource Uri="{Binding ImgSmSrc}"
                                                      CacheValidity="0"
                                                      CachingEnabled="False"                                                    
                                                      /&gt;
                                      &lt;/Image.Source&gt;
                                  &lt;/Image&gt;
                                 &lt;StackLayout InputTransparent="True"&gt;
                                some content...
                                &lt;/StackLayout&gt;
  
                              &lt;/StackLayout&gt;
                          &lt;/ViewCell&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/ListView.ItemTemplate&gt;
  </code></pre>