Relative Content

Tag Archive for c#listviewxamarin.forms

Send an object to a ListView in Xamarin and return a property of the object

My program is a search bar that lists artists’s names using ListView in Xamarin. Now I want to update my program so that when an artist’s name is clicked it goes to another page where I am displaying detailed information about the artist. So now instead of a List<string>, I want to send a List<Artist>(Containing the properties string ArtistName and string ArtistID) to the page, using ListView. I want to display the string ArtistName int the ListView and when that artist is clicked, I want to send his string ArtistID to the method SuggestionListView_OnItemSelected, where I can handle it further.
This is my MainPage.xaml.cs:

Send an object to a ListView in Xamarin and return a property of the object

My program is a search bar that lists artists’s names using ListView in Xamarin. Now I want to update my program so that when an artist’s name is clicked it goes to another page where I am displaying detailed information about the artist. So now instead of a List<string>, I want to send a List<Artist>(Containing the properties string ArtistName and string ArtistID) to the page, using ListView. I want to display the string ArtistName int the ListView and when that artist is clicked, I want to send his string ArtistID to the method SuggestionListView_OnItemSelected, where I can handle it further.
This is my MainPage.xaml.cs: