2012-05-09 25 views
0

讓我們不得不承認的一段代碼:火整個對象OnPropertyChanged當其領域中的一個改變

[...] 
    Private _filterContacts As FilterContacts 
    Public Property FilterContacts() As FilterContacts 
     Get 
      Return _filterContacts 
     End Get 
     Set(ByVal value As FilterContacts) 
      _filterContacts = value 
      OnPropertyChanged("FilterContacts")      
     End Set 
    End Property 

    Private _branchType As Nullable(Of Integer) 
    Public Property BranchType As Nullable(Of Integer) 
     Get 
      Return _branchType 
     End Get 

     Set(ByVal value As Nullable(Of Integer)) 
      _branchType = value 
      OnPropertyChanged("BranchType")     
     End Set 
    End Property 
    [...] 

    Public Sub SomeSub() 
     FilterContacts.BranchType = BranchType 
    End Sub 

我真正改變濾波器的「branchType」,但我想被通知FilterContacts已經改變,不只是其中一個領域。可能嗎?謝謝!

回答

2
Set(ByVal value As Nullable(Of Integer)) 
    _branchType = value 
    OnPropertyChanged("BranchType")     
    OnPropertyChanged("FilterContacts")  
End Set 

或者,如果你想在對象上無效的所有屬性,只要做到這一點:

OnPropertyChanged("")  
相關問題