Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

INotifyPropertyChanged not updating DataGridView

$
0
0

I've found many threads on this, but they tend to be due to some mis-implementation of the INotifyPropertyChanged  interface.  In my case, I'm using Microsoft's XSD utility to generate a series of nested objects.  I used the /edb flag that causes the generated code to implement the INotifyPropertyChanged interfaces.  All I had to write was about ten lines of code using an XmlSerializer to stream in and deserialize an xml file into objects.  I then assign one of the XSD generated arrays to a DataGridView and sure enough all the columns and data show up fine. 

If I then programmatically change a value in one of the objects, it doesn't update the grid cell.  If I manually cause the cell to repaint, the change is then evident.  I stepped through the MS generated object, see the property get updated and pass on to the RaisePropertyChange method.  In there the PropertyChanged event handler is still null.  I interpret that the DataGridView didn't register to get the feed back when its DataSource field is assigned.

I guess, I assumed that since Microsoft wrote the generator that created the INotifyPropertyChanged code and DataGridView that is a sync for INotifyPropertyChanged, that it should have just worked.  It doesn't appear that there is anything I can do since I'm not in control of either end.  What am I missing?

Thanks for any help you can provide


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>