Paul Joseph Dar Santos Paul Joseph Dar Santos - 1 year ago 143
Android Question

How to get the data of the ListView cell being tapped. (XAMARIN FORMS)

our itemSource is from a json data and we deserialize it so we can put it in the Xaml listview and I cannot get the value of the cell being tapped.

This is my .cs

List<Debtor> ro = JsonConvert.DeserializeObject<List<Debtor>>(filteredResult2);
CustListView.ItemsSource = ro;

CustListView.ItemSelected += async (sender, e) =>
await DisplayAlert("Selected", e.SelectedItem.ToString() + " was selected.", "OK");
// await Navigation.PushAsync(new SalesHeaderPage());

This is my .xaml

<ListView x:Name="CustListView">
<ViewCell >
<StackLayout Orientation="Vertical" Padding="8,0,8,0">
<Label Text="{Binding debtor_name}" TextColor="#000" FontSize="14" LineBreakMode="TailTruncation" />


enter image description here

Answer Source

you have to cast it

something like

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download