In my WinForms I have a model with its properties (just plain) and then I have a ViewModel that basically is the same as the model class except it implements INotifyPropertyChanged and calls NotifyPropertyChanged when there is a value change.
Then in my WinForm I have my model instance assigned to the binding source:
bindingSource1.DataSource = myModelInstance;
Then I call (in the constructor) a method in which I initialize the data bindings like this:
this.textbox.DataBinding.Add("Text", bindingSource1, "FirstName", true, DataSourceUpdateMode.OnPropertyChanged);
When the form loads I see the controls are initialized to the values in the underlying model. HOWEVER, if I change the values on the control (not the model!) and press the OK button, I do:
bindingSource1.EndEdit();
Close();
but the problem is that whatever changes were made in the controls (UI), are not reflected back on the underlying data source object (the model).
What am I missing?