1

I have a ProjectModel and a ProjectViewModel class; my Model handles direct manipulation of a project, while the view model is providing the "view friendly" properties and commands

However, in my ViewModel I'm exposing the read-only project contract for view binding

private ProjectModel Model { get; set; } 

public IProject Project
{
    get
    {
        return Model.Project;
    }
}

So here, the property Model doesn't change, but the property Model.Project will change, and so Model will raise its PropertyChanged event when it does

Now, I know Fody-PropertyChanged has the ability to detect if a property is dependent on another property (in the same class) and raise the change event if the other changes.

I was wondering whether it is possible for Fody-PropertyChanged to raise PropertyChanged("Project") when the Model object raises its changed notifier.

I could do it manually, of course; but I'd prefer to stick with Fody. Is this a bad idea? Alternatively, is this a bad MVVM practice to begin with?

Simon
  • 33,714
  • 21
  • 133
  • 202
Meirion Hughes
  • 24,994
  • 12
  • 71
  • 122
  • 1
    what value do you get by wrapping Model? Why not just bind directly to Model.Project – Simon Mar 30 '13 at 00:01
  • @Simon The value one gets is not quite evident by this particular example as it’s simplified (and rightfully so). Consider a case where the getter performs some logical curation on `Model.Project` before returning a value. – Ash Jun 10 '19 at 01:55

1 Answers1

1

No Fody-PropertyChanged does not currently support detecting wrapped properties in the way you describe.

Simon
  • 33,714
  • 21
  • 133
  • 202