Reputation: 3218
I have successfully bound my DataGridView to a list. But, the grid doesn't refresh when I programatically change some of the properties of one of the objects within the list. If I click in the cell (or minimize and then maximize form), the displayed value is refreshed.
I read here that I should use a BindingList. The list I am using is an interface type which doesn't implement IBindingList. But, the concrete type being used to initialize the list does inherit off of BindingList. Any ideas?
Upvotes: 8
Views: 3618
Reputation: 4630
Your list must implement IBindingList
(or be a BindingList
) and your object must implement INotifyPropertyChanged
. Both conditions are required for your DataGridView to bind properly.
So if your data source would be, for instance, MyList<MyClass>
, MyList
must implement IBindingList
and MyClass
must implmenent INotifyPropertyChanged
.
Here is a neat example: http://crazorsharp.blogspot.com/2009/06/inotifypropertychanged-how-to-and-when.html
Upvotes: 11