In my project I want to display a List on a user control. For that I have a CategoryView the user control with an ListView-control, where I want to display the List. And the CategoryViewModel. On the ViewModel I have a list - property where I also raise the property changed event.
public class CategoryViewModel : NotificationObject
{
private List<string> categoryList;
public List<string> CategoryList
{
get
{
return this.categoryList;
}
set
{
this.categoryList = value;
this.RaisePropertyChanged("CategoryList");
}
}
}
This List is binded to the ListView-element in the view.
If I change the List in the CategoryViewModel, it works fine and the property change event is raised. If I change the List from the MainWindowViewModel. No property Changed event is Raised and the View will not be updated. How do I have to do that?
On the MainWindowViewModel I change the CategoryList. The List will be filled correctly.
CategoryViewModel categoryViewModel = new CategoryViewModel();
categoryViewModel.CategoryList = logger.ReadLogfile(this.logFileName).ToList();