tags:

views:

22

answers:

1

I need the DataGridView to update the cell contents OnPropertyChanged, rather to OnValidate.

The DataGridView is bound to a BindingSource, sourced by a subclass of BindingList with custom business objects.

The DataGridView is for selecting the desired object, that is then bound to common controls on the form, so the user can edit it. It is only odd, that the DataGridView does not get updated while the TextBoxes are edited. The business objects support INotifyPropertyChanged, IEditableObject, IDataErrorInfo.

Any ideas on how to achive this?

A: 

It seems it does not work directly by changing the DataSourceUpdateMode. You can use the DataGridView CellContentClick event to find out when the user clicked on the check box or when the user changed the check by hitting the space bar.

At that point you can execute DataGridView::EndEdit to commit the cell column. And then call BindingSource::EndEdit to commit the entire row.

You can use the following links to understand and get your solution robust:

http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/3aa81b24-2911-44ad-baf4-2619557b374e

http://connect.microsoft.com/VisualStudio/feedback/details/116030/datagridview-lacks-support-for-binding-datasourceupdatemode

Kangkan
Sadly, the user should not edit the values inside the datagrid directly.
BeowulfOF