I'm using "Simple MVVM Toolkit" (MVVM noob here) to develop a C# WPF app.
I have a model class called A:
public class A : ModelBase<A>
{
//properties, constructors, methods..
}
..and another model class called B which inherits from A but exposes a property which A doesn't have:
public class B : A
{
private string additionalProperty;
public string AdditionalProperty
{
get { return additionalProperty; }
set
{
additionalProperty = value;
//NotifyPropertyChanged(m => m.AdditionalProperty); <-- problem here
}
}
}
Problem comes with the commented line above: the lambda in NotifyPropertyChanged won't work because m.AdditionalProperty doesn't exist, since m is of type A, not B. What happens in this case? I should note that NotifyPropertyChanged comes with the toolkit and is not a custom implementation.
EDIT: Here is the IntelliSense description for NotifyPropertyChanged in B:
void ModelBaseCore<A>.NotifyPropertyChanged<TResult>(System.Linq.Expressions.Expression<Func<A,TResult>> property)
Allows you to specify a lambda for notify property changed