First of all you need an ObservableCollection<Daily>
Then you need to iterate using foreach loop and the last step is to add the Data Binding.
Let me share the code with you.
public ObservableCollection<Daily> DailyCollection { get; set; }
public MainPage()
{
InitializeComponent();
DailyCollection = new ObservableCollection<Daily>();
}
public async Task<WeatherRoot> GetTemperatureDetails()
{
var httpClient = new HttpClient();
var response = await httpClient.GetStringAsync("MyApiEndpointURL");
return JsonConvert.DeserializeObject<WeatherRoot>(response);
}
protected override async void OnAppearing()
{
base.OnAppearing();
var tempDetails = await GetTemperatureDetails();
foreach (var item in tempDetails.Daily)
{
DailyCollection.Add(item);
}
}
Now you can bind the Model class properties inside your XAML Page.
To bind the Temp property of Daily Class with your Label you need to write the following code.
<Label Text="{Binding Temp}"/>
But remember to bind the Icon property of Weather Class with your image control you need to use
<Image Source="{Binding Weather[0].Icon}" />