Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Assigning an id to a listview item and getting that id when that list item was tapped.

$
0
0

I am populating my list view with data I get from a JSON call. I get a name and a corresponding id. I populate the list view with the names as follows.

listView.ItemTemplate.SetBinding(TextCell.TextProperty, "Name");

Now What I want to do with the id is something like

listView.ItemTemplate.SetBinding(TextCell.Id, "NameId");

where the id is hidden from the user.

And do something like the following when an item is clicked get the id

listView.ItemTapped += (sender, e) => {

                System.Diagnostics.Debug.WriteLine(e.item.Id );

            };

Any ideas on how I can accomplish this?``


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>