I don't know what is wrong with the binding, but nothing shows up. I want it to take all of the items in the collection from WeatherForecastController class and output them in the ListBox
XAML code:
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WeatherApp"
xmlns:model="clr-namespace:WeatherApp.Model"
Title="Weather app" Height="300" Width="500">
Controller:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Threading;
namespace WeatherApp.Model {
public class WeatherForecastController {
private ObservableCollection
public WeatherForecastController() {
weatherForecasts.Add(new WeatherForecast());
}
internal ObservableCollection
get { return weatherForecasts; }
set { weatherForecasts = value; }
}
}
}
WeatherForecast class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WeatherApp.Model {
internal class WeatherForecast {
private string dayOfTheWeek = "Monday";
private string message = "Varmt!";
public string Message {
get { return message; }
}
public string DayOfTheWeek {
get { return dayOfTheWeek; }
}
}
}
Replies
Know the answer? Post it — somebody with the same question will find it here.