tags:

views:

12

answers:

1

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));
    }
}
+1  A: 

Use the property instead. Thats, what it's for

Or if you must, call SendPropertyChanged("ImageName") whenever you change the private field.

hkon