Remember to use a property when data binding in Windows Presentation Foundation. If you don’t remember this, you will spend at least one hour scratching your head wondering why the data won’t show up in your list box and swearing at Visual Studio 2010. But, it’s not studios fault, it’s yours!
This is wrong (field):
public List<string> MyProperty;
This is correct (property):
private List<string> _myProperty;
public List<string> MyProperty
{
get { return _myProperty; }
set { _myProperty = value; }
}
I will never do this again!
Tags: