Consider adding SetProperty, using the CallerMemberName attribute, to the ObservableObjectBase

Docking/MDI for WPF Forum

Posted 9 years ago by Eric P
Version: 16.1.0630
Avatar

public string Description {
  get { return _description; }
  set { _description = value;
        NotifyPropertyChanged(“Description”);
      }
}

 

public string Description {
    get { return _description; }
    set { SetProperty(ref _description, value); }
}

 

protected virtual bool SetProperty<T>(ref T storage, T value [CallerMemberName] string propertyName = null) {

  if (object.Equals((object)storage, (object)value))
    return false;

  storage = value;
  this.NotifyPropertyChanged(propertyName);
  return true;
}

 

Comments (1)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Eric,

We would like to but we still target .NET 4.0 and I believe that feature was added in .NET 4.5.  So until we upgrade our target platform, we can't add that yet.


Actipro Software Support

The latest build of this product (v24.1.3) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.