I am writing the test application in Windows Forms. It has a simple form with TextBox and needs to implement DataBinding. I have implemented the class FormViewModel to hold
The Databinding
behavior was changed in .NET 4.0. Your code works on .NET 3.5. I found this issue posted at Microsoft Connect: .Net 4.0 simple binding issue
Here was the work-around that worked for me. Use a BindingSource
as the data object:
BindingSource bs = new BindingSource(_viewModel, null);
//textBox1.DataBindings.Add("Text", _viewModel, "CurrentObject.TestPropertyString");
textBox1.DataBindings.Add("Text", bs, "CurrentObject.TestPropertyString");