title: Binding to ListView item tapped property from View Model
body: <p>I am trying to bind an event to a ListView, on my menu page, using the itemtapped property. Currently I am using MVVM (Xamarin form labs) framework in my app. What I am trying to accomplish is when a user taps the menu item the app navigates to the correct view. </p>
  
  <p>Here is the xaml code:</p>
  
  <pre><code>&lt;ListView x:Name="list"
          ItemsSource="{Binding MenuItems}" 
          SelectedItem="{Binding SelectedItem}" 
          ItemTapped= SET-BINDING-HERE &gt;
    &lt;ListView.ItemTemplate&gt;
      &lt;DataTemplate&gt;
        &lt;ViewCell&gt;
          &lt;ViewCell.View&gt;
            //setup template here
          &lt;/ViewCell.View&gt;
        &lt;/ViewCell&gt;
      &lt;/DataTemplate&gt;
    &lt;/ListView.ItemTemplate&gt; 
  &lt;/ListView&gt;
  </code></pre>
  
  <p>I want to bind the itemtapped event to this function:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public void NavigateTo(object sender, ItemTappedEventArgs args)
    {
        var test = args.Item as MenuModel;
        cPageTypes.GetByKey(test.CommandParameter)
                  .SwitchRootPage(AIMCore.ViewModels.ElliottBaseViewModel.MasterPage);
        list.SelectedItem = null;
        AIMCore.ViewModels.BaseViewModel.MasterPage.IsPresented = false;
    }
  </code></pre>
  
  <p>I can currently get this to work if I add the function to the view's code behind and then set the <strong>ItemTapped='NavigatTo</strong>', but this seems wrong as it defeats the MVVM concept. What I really want to do is bind the event this same functionality in my ViewModel something like this:</p>
  
  <pre><code>&lt;ListView x:Name="list"
          ItemsSource="{Binding MenuItems}" 
          SelectedItem="{Binding SelectedItem}" 
          ItemTapped= "{Binding NavigateTo}" &gt; // this binding is to the ViewModel
  </code></pre>
  
  <p>However this is not working or I am not doing it correctly. When I try implement it this way the code produces and error.</p>
  
  <p><strong>Error:</strong> 
  Xamarin.Forms.Xaml.XamlParseException: No Property of name ItemTapped found at Xamarin.Forms.Xaml.BaseValueNode.SetPropertyValue   </p>