Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
610
Updating property in BindingList<T> doesn't update Grid
posted

I just made a simple project demoing this if y'all would like to take a look (see attached .zip file).

But here's the basic setup (code omitted for brevity):

  Public Class Greeting
    Public Property Greeting As String
    Public Property Message As String
  End Class
Public Property Messages As New BindingList(Of Greeting)
UltraGrid1.DataSource = Messages
Messages(0).Message = "Something else"

Obviously, the code isn't all in a row like this. They're in the appropriate methods. But the point is this: that last line is updating something in the grid's DataSource. I'd like that change reflected in the grid.

Unfortunately, in the actual project I'm working on, the only connection between where the data is set and where the grid resides is that list. Calling some sort of refresh on the grid isn't an option. It seems like simply updating the collection my grid is bound to should be enough. Is there something I'm missing? Thanks!

BindingList-PropertyUpdate-Issue.zip
Parents
  • 1339
    Verified Answer
    Offline posted

    Your Greeting class needs to implement INotifyPropertyChanged.  INotifyPropertyChanged must be be implemented on classes you put in a BindingList if you wish for the BindingList to detect changes to properties of an item in the list (otherwise it will only raise notifications for changes to the list itself; adding or removing items).

Reply Children
No Data