Reputation: 2113
I have a collection of class A
, and this class A
has a property called Type
. Based on the value of Type
the background of the corresponding visual item in the view will change. I am implementing INotifyPropertyChanged
in the ViewModel
, but I do not want for class A
to implement INotifyPropertyChanged
. Also using ObservableCollection
will effect the performance. Now the question is how can I notify the view that the property Type
has changed?
Upvotes: 0
Views: 252
Reputation: 169420
Now the question is how can I notify the view that the property
Type
has changed?
Either implement INotifyPropertyChanged
on Type
or don't bind directly to a property of Type
but to a property of A
that wraps the property of Type
, e.g.:
private Type _type = new Type();
public string Name
{
get { return _type.Name; }
set { _type.Name = value; OnPropertyChanged(); }
}
Upvotes: 1