title: Listview DataTemplateSelector pass parameter to DataTemplate
body: <p>I need to send the ObservableCollection as parameter to my custom viewcell, that is invoked through a DataTemplateSelector. Any ideas?</p>
  
  <p>What I want is to remove one Listviewitem when the users clicks a button contained on each item.</p>
  
  <p>Here is the code in the TemplateSelector:</p>
  
  <pre><code>private readonly DataTemplate templateOne;
  private readonly DataTemplate templateTwo;
  
  public ItemTemplateSelect(ObservableCollection&lt;Item&gt; _items)
  {
      templateOne = new DataTemplate(typeof(TemplateOneCell));
      templateTwo = new DataTemplate(typeof(TemplateTwoCell));
  }
  
  protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
  {
      if (((Item)item).status == -1)
      {
          return templateOne; &lt;---- Here I want to send '_items' as parameter
      }
      else
      {
          return templateTwo;
      }
  }
  </code></pre>
  
  <p>Here is an example of my viewcell:</p>
  
  <pre><code>public class ContactCell : ViewCell
  {
      public ContactCell()
      {
          var okButton = new Button()
          {
              Text = "OK"
          };
          okButton.Clicked += okButton_Clicked;
  
          var frame = new Frame
          {
              Padding = 0,
              Margin = 0,
              Content = okButton
          };
  
          View = frame;
      }
  
      private async void okButton_Clicked(object sender, EventArgs e)
      {
          -------------&gt; delete current item
      }
  }
  </code></pre>
  
  <p>Thanks in advance.</p>