title: Xamarin.Android get object properties from ListView click event
body: <p>I am very new to C# (a few weeks) and Xamarin (about a week). </p>
  
  <p>I was able to implement the ListView Adapter from the tutorial "Display Entity Collection in ListView on Android (//from <a href="http://diptimayapatra.wordpress.com/2013/07/08/xamarin-display-entity-collection-in-listview-in-android/" rel="nofollow">http://diptimayapatra.wordpress.com/2013/07/08/xamarin-display-entity-collection-in-listview-in-android/</a>)</p>
  
  <p>My problem now is that I have no idea how to handle the click event on the TextView text.</p>
  
  <p>The GetView code from my Adapter is:</p>
  
  <pre><code>public override  View GetView(int position, View convertView, ViewGroup parent)
  {
      var incident = incidents[position];
      View view = convertView;
      if(view == null)
      {
          view = context.LayoutInflater.Inflate(
              Resource.Layout.ListViewTemplate, null);
      }
  
      view.FindViewById&lt;TextView&gt;(Resource.Id.tvIncident).Text = 
          string.Format("{0}", incident.title);
  
      view.FindViewById&lt;TextView&gt;(Resource.Id.tvIncidentDescription).Text = 
          string.Format("{0}", incident.description);
  
      return view;
  }
  </code></pre>
  
  <p>My Incident object code is:</p>
  
  <pre><code>public class Incident
  {
     public int id {get; set;}
     public string title {get; set;}
     public string description {get; set;}
     public double latitude {get; set;}
     public double longitude {get; set;}
  }
  </code></pre>
  
  <p>then the code in the activity is</p>
  
  <pre><code>protected override void OnCreate(Bundle bundle)
  {
      base.OnCreate(bundle);
      SetContentView(Resource.Layout.Main);
      listView = FindViewById&lt;ListView&gt;(Resource.Id.list);
  
      IncidentGet incGet = new IncidentGet();
      List&lt;Incident&gt; incidents = incGet.GetIncidentData()
  
      listAdapter = new ListViewAdapter(this, incidents);
      listView.Adapter = listAdapter;
  
      listView.ItemClick += listView_ItemClick;
  }
  </code></pre>
  
  <p>then</p>
  
  <pre><code>void listView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
  {
      //have no idea how to get the properties of each Incident object here
  }
  </code></pre>
  
  <p>I am not sure if the listView_ItemClick is the way to go or is there some other way. Any suggestions will be greatly appreciated</p>