In my c# app (MVVM Pattern) I have something like this:
private List<MyClass> _classes= new List<MyClass>();
public List<MyClass> Classes
{
get { return _classes; }
set
{
_servers = value;
NotifyOfPropertyChange(() => Classes);
NotifyOfPropertyChange(() => Classes2);
}
}
public List<MyClass> Classes2
{
get
{
return Classes.Where(class=> class.boolValue).ToList();
}
}
And when I use Classes.Add(class)
or Classes.Remove(class)
setter doesn't called. Why?
Because you aren't changing the Classes
property -- you are changing the internal state of the object referenced by Classes
. If you need to be notified of changes to the list, you may want to look into ObservableCollection
:
http://msdn.microsoft.com/en-us/library/ms668604.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With