Reputation: 1996
I have a ClassA
with an ObservableCollection
property, that implements the INotifyPropertyChanged
interface
on my window codebehind I have declared a ClassA variable
, and initialize it in the Main() method.
i'd expect that variable.PropertyChanged
would have a WPF event wired to it, but apparently the PropertyChanged
event remains null
Upvotes: 12
Views: 3935
Reputation: 7709
I'm not sure if this exactly answers your question, but I had similar experiences, and blogged about it here.
Essentially, make sure the DataContext is not null when the binding occurs, such that PropertyChanged events can get back to the UI...
Upvotes: 0
Reputation: 564373
WPF will subscribe to the PropertyChanged event when you bind to your object. This is the core way that databinding works.
It actually does this via the PropertyChangedEventManager using the WeakEvent pattern in WPF.
Upvotes: 13