Displaying a collection and selecting a row
The main requirement for ListView
to work is to provide a collection of data where each item will be translated to a row.
ListView
exposes an event that will notify you when a row is tapped; usually, you'll want to register an event handler to navigate to another page.
How to do it…
- In Visual Studio, go to the top menu and select File | New | Project, choose the Blank App (Xamarin.Forms Portable) template, name it
XamFormsDisplayCollections
, and click OK. - The first thing we need is to create our model class and some dummy data to load in
ListView
. Right-click the PCL, Add | Class…, name itCharacter
, and click Add. Find next the abbreviated version of theCharacter
class; refer to the module code for this ...
Get Xamarin: Cross-Platform Mobile Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.