I am currently learning MVVM and i don't understand how RaisePropertyChanged
is important
For example this function :
public City SelectedCity
{
get
{
return selectedcity;
}
set
{
RaisePropertyChanging(SelectedCityLocationPropertyName);
selectedtrend = value;
RaisePropertyChanged(SelectedCityLocationPropertyName);
MessageBox.Show(City.Name);
}
}
and this one :
public City SelectedCity
{
get
{
return selectedcity;
}
set
{
// RaisePropertyChanging(SelectedCityLocationPropertyName);
selectedtrend = value;
// RaisePropertyChanged(SelectedCityLocationPropertyName);
MessageBox.Show(City.Name);
}
}
Give exactly the same result for me. Can you please tell me why is RaisePropertyChanged
so important and give me an example where it would make a vital difference?