I have a ListBox simplified for the next XAML
<ListBox ItemsSource="{Binding Properties}"
DisplayMemberPath="Name"
SelectedItem="SelectedProperty" />
and in my ViewModel:
private List<Property> propertyList;
private Property selectedProperty;
public List<Property> Properties
{
get
{
return propertyList;
}
set
{
propertyList = value;
NotifyPropertyChanged("Properties");
}
}
public Property SelectedProperty
{
get
{
return selectedProperty;
}
set
{
NotifyPropertyChanged("SelectedProperty");
selectedProperty= value;
}
}
The Favorites field fills perfectly, but no matter what I try, I seem to be unable to get SelectedProperty to update when I select an item in my list. I tried to switch everything around to use ObservableCollectioninstead Listand add an event handler for CollectionChanged, but that didn't work.
I am sure that I am missing something stupid, and I do not see a tree for trees. I get to the end of my cable and need someone to intervene and help.
source
share