I have this BaseClass:
public class BaseViewModel : INotifyPropertyChanged { protected void OnPropertyChanged(string propertyName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } public event PropertyChangedEventHandler PropertyChanged; }
and another class:
public class SchemaDifferenceViewModel : BaseViewModel { private string firstSchemaToCompare; public string FirstSchemaToCompare { get { return firstSchemaToCompare; } set { firstSchemaToCompare = value; if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("FirstSchemaToCompare"));
PropertyChanged here (2 times), red is underlined, it says:
Error 1 The event BaseViewModel.PropertyChanged' can only appear on the left hand side of += or -= (except when used from within the type 'SchemaDifferenceFinder.ViewModel.BaseViewModel')
What am I doing wrong? I just moved PropertyChangedEvent to a new class: BaseViewModel ..
source share