When we present the weather data, we will group it by day so that all of the forecasts for one day will be under the same header. To do this, we will create a new model called ForecastGroup. To make it possible to use this model with the Xamarin.Forms CollectionView, it has to have an IEnumerable type as the base class. Let's set this up:
- Create a new class called ForecastGroup in the Models folder.
- Add List<ForecastItem> as the base class for the new model.
- Add an empty constructor and a constructor that has a list of ForecastItem instances as a parameter.
- Add a Date property.
- Add a property, DateAsString, that returns the Date property as a short date string.
- Add a property, Items, that returns the list of ForecastItem instances, as shown in the following code:
using System;
using System.Collections.Generic;
namespace Weather.Models
{
public class ForecastGroup : List<ForecastItem>
{
public ForecastGroup()...