title: How to remove an item from a Xamarin Forms ListView?
body: <p>I'm trying to remove items/rows from a <code>ListView</code> but the difficulty is that I need to also pass in some delegate or fire some event or something, so when a person clicks a button to remove that row, my code handles some other logic, elsewhere (eg. remove the item from the DB or whatever).</p>
  
  <p>I have a custom control I made:</p>
  
  <pre><code>public class SportsTeam : StackLayout { .. }
  </code></pre>
  
  <p>Inside this control, one of the elements is a <code>ListView</code> which lists all the people in a sporting team.</p>
  
  <pre><code>var viewModel = teamMembers.Select(x =&gt; new SportsTeamViewModel(x));
  
  return new ListView
  {
      HasUnevenRows = true,
      ItemSource = viewModel,
      ItemTemplate = new DataTemplate(typeof(SportsTeamViewCell)); 
  };
  </code></pre>
  
  <p>Inside the <code>SportsTeamViewCell</code> I have the following:</p>
  
  <pre><code>private Grid CreateContent()
  {
      var grid = new Grid();
      // Setup row and column definitions.
      // Add items to the Grid 
      grid.Children.Add(...);
  
      var removeButton = RemoveButton;
      grid.Children.Add(removeButton);
      Grid.SetRowSpan(removeButton, 2);
  
      return grid;
  }
  
  private Button RemoveButton
  {
      get
      {
          var button = new Button
          {
              Image = "Icons/remove.png"
          };
  
          return button;
      }
  }
  </code></pre>
  
  <p>From here, I don't know how to make it so that the button fires an event or some delete could be passed in via the constructor, so some custom logic is performed against the individual cell/row/item that is to be removed.</p>