I have:
ocPieces = ObserveableCollection(Of Piece)
where a Piece is:
Public Class Piece
Implements INotifyPropertyChanged
Public Property PieceID As Integer
Public Property Description As String
<Numerous Other properties>
End Class
ocPieces is the Source of the items in a ListBox named lbxPieces. Standard stuff.
The user can add new pieces to ocPieces, which triggers the CollectionChanged event so that:
lbxPieces.Items.Refresh()
updates the ListBox. However, when the user changes, for example, the Description of one of the pieces, this does not trigger the CollectionChanged event so that refreshing the ListBox does not update its items.
Do I need to raise the PropertyChanged event of ocPieces? If so, how do I do that?
Would rebinding the ListBox work? Again, if so how do I do that?
If those are not the right approach, how can I refresh the ListBox after an item property has changed?
EDIT EDIT EDIT
To me, the problem and solution are both obvious - I just don't know how to implement the solution.
The problem is that changing the properties of an item in an ObservableCollection does not change that collection. Thus a ListBox.Items.Refresh does not work because it doesn't know the collection has changed. Well then. the obvious solution is to raise the CollectionChanged event when the user makes a change to a property. That's where I need help, not with the answers provided so far.
