I am just starting with MVVM and have hit a hurdle that I hope someone can help me with. I am trying to create a simple View with 2 listboxes. A selection from the first lis
You need to raise the change notification on the Level2MenuItems property.
Instead of having
public ObservableCollection Level2MenuItems { get; set; }
you need
private ObservableCollection _level2MenuItems;
public ObservableCollection Level2MenuItems
{
get { return _level2MenuItems; }
set
{
_level2MenuItems = value;
RaisePropertyChanged("Level2MenuItems");
}
}
The reason the former works in the constructor is that the Binding has not taken place yet. However since you are changing the reference via a command execute which happens after the binding you need to tell view that it changed