INotifyPropertyChanged for the property containing the list i

Hi i am using this code in myClass to change content in wpf app

      public event PropertyChangedEventHandler PropertyChanged;
  protected void Notify(string propertyName)
  {
     if (this.PropertyChanged != null)
     {
        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
     }
  }

      

Every time I change a property in myClass, it changes the labels that I have in my application.

 <Label Content="{Binding Category}" Padding="7,0,0,0" />

      

this works fine, but in myClass I have a property containing ilist for another Article class

private IList<Article> m_articles = new List<Article>();

      

Now to answer the question, the Notify method does not update the content in my Ilist, I can change it with ilist and view. All property in myclass works fine if it's a string or int, but when it's an Ilist it won't update. I hope you guys understand what I mean, my english is bad. thanks for the help

here's the code in xaml

                            <ListBox Name="ArtInfo" ItemsSource="{Binding Path=Articles}">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Label Content="{Binding Artnr}" />
                                </DataTemplate>
                            </ListBox.ItemTemplate>

      

{Binding Path = Articles} <is a property that contains ilist <is a property in the Article class

0


a source to share


1 answer


You should use ObservableCollection <Article> instead of list <Article>



+7


a source







All Articles