I have a "MainModelView" that implements INotifyPropertyChangedand has a property that provides ObservableCollection<T>, called ExposedCollection. In our MainPage.xaml, we have a ListBox whose ItemsSource object must be bound to MainModelView.ExposedCollection.
MainModelView makes a REST call to populate ExposedCollectionin the background. When WebClientexecuted, its ASyncCallback calls NotifyPropertyCHanged, which checks to see if the PropertyChanged event is null, and if it does not raise it. Pretty simple stuff
The problem is that the ListBox is never bound to an ExposedCollection. I set a breakpoint on our zero check for NotifyPropertyChanged, and there are never listeners on PropertyChanged.
I tried to create an instance of MainViewModel in PhoneApplicationPage.Resources, in, PhoneApplicationPage.DataContextand PhoneApplicationFrame.DataContextin App.xaml. In all cases, the PropertyChanged event is still zero. What am I missing here?
<phone:PhoneApplicationPage.DataContext>
<gmvm:MainViewModel x:Name="MainViewModel" />
</phone:PhoneApplicationPage.DataContext>
...
<ListBox x:Name="MyListBox" ItemsSource="{Binding ExposedCollection}" Margin="0,20,-12,0">
.....
</Listbox>
source
share