title: TextView inside Recyclerview ViewHolder - OnClickListner
body: <p>I have a very simple <code>RecyclerView</code> and a <code>ViewHolder</code> as following</p>
  <p><strong>ViewHolder</strong></p>
  <pre><code> private class SENT_VH : RecyclerView.ViewHolder, View.IOnClickListener
      {
          public SENT_VH(View itemView) : base(itemView)
          {                
              MyText = itemView.FindViewById&lt;TextView&gt;(Resource.Id.sent_msg_time);
              DeleteButton = itemView.FindViewById&lt;TextView&gt;(Resource.Id.sent_msg_person_name);               
              itemView.SetOnClickListener(this);
          }           
          public TextView DeleteButton { get; set; }          
          public TextView MyText { get; set; }           
  
          public void OnClick(View v)
          {
              // ViewHolder Item clicked
          }          
      }
  </code></pre>
  <p>This work perfectly when I click on the item but I am trying to implement OnClickListner on <code>DeleteButton</code> as following</p>
  <pre><code>public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
      {
          try
          {
              SENT_VH viewHolder = holder as SENT_VH;                            
              viewHolder.MyText.Text = itemList[position].userText;
              viewHolder.DeleteButton.SetOnClickListener(new DeleteOnClickListner(itemList[position].id, context, position));
          }
          catch (Exception X)
          {
              //LOG.Error &gt;&gt; ERROR
          }
      }
  </code></pre>
  <p>Finally my <code>DeleteOnClickListner</code> is</p>
  <pre><code>  class DeleteOnClickListner : Java.Lang.Object, View.IOnClickListener
      {
          private decimal id;
          private Context context;
          private int pos;
          public DeleteOnClickListner(decimal id, Context context, int pos)
          {
              this.id = id;
              this.context = context;
              this.pos = pos;
          }
          public void OnClick(View v)
          {
              Android.Util.Log.Debug(&quot;ADAPTER&quot;, &quot;Delete id: &quot; + id);
              ((MainActivity)context).deleteConfirmation(id, pos);
          }
      }
  </code></pre>
  <p>In the MainActivity for <code>deleteConfirmation</code> method I am just trying to get the position and id as following</p>
  <pre><code>public void deleteConfirmation(decimal id, int pos)
   {
      EVENT_LOGGER(TAG, &quot;Pos:&quot; + pos + &quot;, id: &quot; + id);
   }
  </code></pre>
  <p>The problem is I always get the same <code>id</code> and <code>position</code> as the first <code>DeleteButton</code> I click in any ViewHolder, it never changes.</p>
  <p>For example, if I first clicked on the <code>DeleteButton</code> at item position 10, it keeps sending position 10 no matter which <code>DeleteButton</code> I click next.</p>
  <p>Do you guys have any idea what is going on</p>
  <blockquote>
  <p><strong>EDIT:</strong></p>
  </blockquote>
  <p>As suggested by @tyczj, I tried to move OnclickListner in my ViewHolder by adding the following in my ViewHolder</p>
  <pre><code>public void SetMyView(decimal id, Context context, int pos)
          {               
              DeleteButton.SetOnClickListener(new DeleteOnClickListner(id, context, pos));
          }
  </code></pre>
  <p>And Using SetMyView in my <code>OnBindViewHolder</code> as following</p>
  <pre><code>public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
  {
      try
      {
          SENT_VH viewHolder = holder as SENT_VH;   
          viewHolder.SetMyView(position, context);  //This line here                       
          viewHolder.MyText.Text = itemList[position].userText;
          viewHolder.DeleteButton.SetOnClickListener(new DeleteOnClickListner(itemList[position].id, context, position));
      }
  </code></pre>
  <p>No Difference exactly the same result
  catch (Exception X)
  {
  //LOG.Error &gt;&gt; ERROR
  }
  }</p>
  <p><strong><code>EDIT 2 - Working Solution</code></strong></p>
  <p>I updated the VH to just add the following</p>
  <pre><code>DeleteButton.SetOnClickListener(new DeleteOnClickListner(AdapterPosition));
  </code></pre>