I am new at C# and databinding, and as an experiment I was trying to bind the form title text to a property:
namespace BindTest
{
public partial class Form1 : Form
{
public string TestProp { get { return textBox1.Text; } set { } }
public Form1()
{
InitializeComponent();
this.DataBindings.Add("Text", this, "TestProp");
}
}
}
Unfortunately, this does not work. I suspect it has something to do with the property not sending events, but I don't understand enough about databinding to know why exactly.
If I bind the title text directly to the textbox, like this:
this.DataBindings.Add("Text", textBox1, "Text")
Then it does work correctly.
Any explanation about why the first code sample does not work would be appreciated.