public ObservableCollection<App> Apps { get; set; }
public MainWindow()
{
Apps = LoadApps();
listview.ItemsSource = Apps;
}
public void AnotherMethod()
{
Apps = LoadApps();
}
It works when assigned to ItemsSource but I need the ListView to be updated every time the Apps content is changed.
What do you mean by “Apps content”? If you replace the whole reference with a new collection you need to implement
INotifyPropertyChangedinMainWindow. If the items change internally and you want updates in theListViewyou need to implement said interface inApp.(Note about the first possibility: Often you would not allow the replacement of the reference by creating a
private readonlyfield, obviously the public property exposing it would only have a getter.)