私はこのBaseClassのを持っている:INotifyPropertyChangedを実装する1つのベースクラスから継承していますか?
public class BaseViewModel : INotifyPropertyChanged
{
protected void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
およびその他のクラス:
public class SchemaDifferenceViewModel : BaseViewModel
{
private string firstSchemaToCompare;
public string FirstSchemaToCompare
{
get { return firstSchemaToCompare; }
set
{
firstSchemaToCompare = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("FirstSchemaToCompare"));
//StartCommand.RaiseCanExecuteChanged();
}
}
}
のPropertyChangedは(2Times)ここで、赤は下線、それは言う:
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')
私は何間違っている?私は新しいクラスにPropertyChangedEventを総なめ:BaseViewModel ..
リンクをもう一度移動しました:http://george.softumus.com/inotifypropertychanged-and-magic-strings/ –