I'm using a LinkCollection-property of a ViewModel for binding, the LinkCollection is filled in the constructor of the ViewModel:
public SurveySelectionViewModel()
{
foreach (var year in Surveys().Select(x => x.year.ToString()).Distinct())
{
this.Years.Add(new Link { DisplayName = year, Source = new Uri("http://www.stackoverflow.com") });
}
}
The years are shown in the view when my ListCollection "Years" is defined like this:
private LinkCollection years = new LinkCollection();
public LinkCollection Years
{
get { return this.years; }
set
{
if (this.years != value)
{
this.years = value;
}
}
}
Why are the years not showing when I reduce the above to this:
public LinkCollection Years = new LinkCollection();
The LinkCollection is still being filled with years.. but they are not showing.