ListViews and ObservableCollections
Now we move on to StocklistPage
and StocklistPageViewModel
; these will be used to display all the items we pull down from the API. On the frontend we will be using<span highlight=""> </span>ListView
, they are the most common UI elements for displaying lists of data that are pulled down from any API. The beauty of ListViews
is how they are presented via each platform. Placing a ListView
in our XAML sheet via Xamarin.Forms
on iOS will render a UITableView
, on Android a native ListView
, and in Windows a FrameworkElement
. We can also create custom cell items and set up data bindings specific to each item, so with each contract that is deserialized, we want to have a separate view-model that will be used for representing the data on each cell.
Let's add a new file to the ViewModels
folder in the Stocklist.Portable
project called StockItemViewModel.cs
and implement the constructor:
public class StockItemViewModel : ViewModelBase ...