I have the following XAML:
<Grid x:Name="LayoutRoot"> <sdk:DataGrid AutoGenerateColumns="True" Margin="46,38,0,40" x:Name="FamilyListGrid" HorizontalAlignment="Left" Width="475" ItemsSource="{Binding FamilyList}" SelectedItem="{Binding SelectedFamily, Mode=TwoWay}" /> </Grid>
The My FamilyList property used in Binding is an ObservableCollection of objects in my view model class. I found that I need to implement INotifyPropertyChanged in the setter of my FamilyList collection or the binding does not work. In my opinion, ObservableCollection has already implemented this. If so, why do I need to implement the notify property?
If that helps, here is my definition of the FamilyList property:
private ObservableCollection<Services.Family> familyList; public ObservableCollection<Services.Family> FamilyList { get { return familyList; } private set { familyList = value; NotifyPropertyChanged("FamilyList"); } }
source share