问题
I'm getting a (to me) very weird looking argument exception.
When calling this.MainViewModel.MyObject = new MyObject(..some parameters here..);
, I get property or indexer 'IMainViewModel.MyObject' cannot be assigned to -- it is read only
. I've been trying to find people with similar questions but everytime the answer is 'do you have a setter?'. Yes, I do have a setter. Yes, my property is public. I'm very confused as to why it is throwing a fit here.
The property I'm trying to write to is;
public Object MyObject
{
get { return this.myObject; }
set
{
this.myObject = value;
this.RaisePropertyChanged();
this.eventAggregator.GetEvent<SetMyObjectEvent>().Publish(this.MyObject);
}
}
I don't know what I'm missing that qualifies the MyObject property as readonly .. ?
来源:https://stackoverflow.com/questions/39450154/cannot-be-assigned-to-is-read-only-yet-has-a-setter