尝试使用 aBindingList(of T)
代替,然后您可以侦听更改事件:
Imports System.ComponentModel
Public Class Bill
Public prime As BillPrime
Public WithEvents items As BindingList(Of ItemDetails)
Public status As New BillStatus
Public Sub New()
prime = New BillPrime
items = New BindingList(Of ItemDetails)
status = New BillStatus
End Sub
Public Sub items_ListChanged(ByVal sender As Object, ByVal e As ListChangedEventArgs) Handles items.ListChanged
prime.X = "something"
End Sub
End Class
这将需要您的类来实现INotifyPropertyChanged
:
Public Class ItemDetails
Implements INotifyPropertyChanged
Public Event PropertyChanged(ByVal sender As Object, ByVal e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
Private _DetailOne As String
Property DetailOne() As String
Get
Return _DetailOne
End Get
Set(ByVal value As String)
_DetailOne = value
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("DetailOne"))
End Set
End Property
End Class