I开发者_开发百科 would like to send a property changed event of the public property everytime the private member is set. How would I do this?
private string _imageName;
public string ImageName
{
get
{
return _imageName;
}
set
{
_imageName = value;
SendPropertyChanged("ImageName");
}
}
protected virtual void SendPropertyChanged(string propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
Use the property instead. Thats, what it's for
Or if you must, call SendPropertyChanged("ImageName") whenever you change the private field.
精彩评论