Thomas Ayoub
Thomas Ayoub

Reputation: 29431

Control is updated but no event is triggered

I've got a DataGridView which references objects on the application graph. For some reason, the cells are not updated when I add a curve on the graph via drag and drop. When I hover the cell of the data DataGridView some mysterious piece of code is executed. I put a breakpoint at each event triggered by the DataGridView but I was not able to find anything. If I debug step by step, the callstack says External code. Here are the events I follow:

private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
private void dataGridView1_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
private void dataGridView1_DataError(object sender, DataGridViewDataErrorEventArgs e)
private void dataGridView1_CurrentCellDirtyStateChanged(object sender, EventArgs e)
private void dataGridView1_RowContextMenuStripNeeded(object sender, DataGridViewRowContextMenuStripNeededEventArgs e)
private void dataGridView1_MouseDown(object sender, MouseEventArgs e)

The DataSource is set, could this be the culprit ?

How can I investigate more ?

Upvotes: 1

Views: 57

Answers (1)

Junaith
Junaith

Reputation: 3388

The BindingList element type has to implement INotifyPropertyChanged interface for the ListChanged event to fire which in turn updates the DataGridView.

From MSDN: ListChanged notifications for item value changes are only raised if the list item type implements the INotifyPropertyChanged interface.

Implement the INotifyPropertyChanged interface in your custom type.

Upvotes: 1

Related Questions