How to get the data of a ListView item the user has clicked on with listview.GetItemAtPosition(e.Position)?

后端 未结 6 1822
温柔的废话
温柔的废话 2021-01-23 00:36

in a Xamarin.Android app, I have a ListView which I previously populated. In the listview_ItemClick event handler, which correctly fires, I would like to retrieve the text of t

6条回答
  •  再見小時候
    2021-01-23 01:28

    try this it might help

    void OnListItemClick(object sender, AdapterView.ItemClickEventArgs e)
    {
    var listView = sender as ListView;
    var t = tableItems[e.Position];
    Android.Widget.Toast.MakeText(this, t.Heading,   
    Android.Widget.ToastLength.Short).Show();
    }
    

提交回复
热议问题