I am trying to bind Font property of System.Windows.Forms.Label to a property of my class (via forms designer).
This is the exception I am seeing "Cannot bind to the property or column HeaderText on the DataSource"
I tried making my class static and make it expose static properties - it didn't help.
The generated code looks like this:
this.WindowTitle.DataBindings.Add(new System.Windows.Forms.Binding("Font", this.fontManagerBindingSource, "HeaderText", true));
//
// fontManagerBindingSource
//
this.fontManagerBindingSource.DataSource = typeof(FontDefinitions.FontManager);
Here is the font manager class:
public class FontManager
{
/// <summary>
/// Gets or sets HeaderText.
/// </summary>
public static Font HeaderText
{
get { return new Font("Tahoma", 42); }
}
}
What am I doing wrong? Under what circumstances a property can not be bound?