INotifyPropertyChanged在包含i列表的属性上

0 wpf inotifypropertychanged

嗨我在myClass中使用此代码来更改我的wpf applciation中的内容

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

每当我更改myClass中的属性时,它都会更改我在应用中的标签.

 <Label Content="{Binding Category}" Padding="7,0,0,0" />
Run Code Online (Sandbox Code Playgroud)

这工作得很好,但在myClass我有一个属性包含一个ilist到另一个类文章

private IList<Article> m_articles = new List<Article>();
Run Code Online (Sandbox Code Playgroud)

现在我的问题Notify方法不会更新我的Ilist中的内容是否有我的方式来使用ilist和视图进行更新.myclass中的所有属性如果是字符串或int都可以正常工作但是当它是Ilist时它不会更新.希望你们明白我的意思我的英语是坏sry ...感谢您的帮助

这里是xaml中的代码

                            <ListBox Name="ArtInfo" ItemsSource="{Binding Path=Articles}">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Label Content="{Binding Artnr}" />
                                </DataTemplate>
                            </ListBox.ItemTemplate>
Run Code Online (Sandbox Code Playgroud)

{Binding Path = Articles} < - 这是包含ilist的属性< - 这是Article类中的属性

Tho*_*que 7

您应该使用ObservableCollection <Article>而不是List <Article>