Model Attribut on Collection of Models

Topics: Questions
Oct 6, 2014 at 1:42 PM

In my viewmodel I have a Collection of Models
public ObservableCollection<Place> Places
       get { return GetValue<ObservableCollection<Place>>(PlacesProperty); }
       private set { SetValue(PlacesProperty, value); }
I to decorate it with the Model Attribut and override OnModelPropertyChanged
 protected override void OnModelPropertyChanged(object sender, PropertyChangedEventArgs e)
          base.OnModelPropertyChanged(sender, e);
But the method is not called if a property is changed in Model.

How can I solve this?
Oct 6, 2014 at 2:14 PM
I think that's because your model is a collection of places, and you expect a change notification of the Place object (but you are actually watching the Collection<Place> object).
Oct 7, 2014 at 5:22 AM
Yes. I think also that's the problem. But how to solve. Do I have to add a Viewmodel for every place. Or how do I get noticed in viewmodel if a propery in place is changed?
Oct 7, 2014 at 4:56 PM