In an MVVM design, suppsoe if the View creates the ViewModel, how should the ViewModel know about its Model?
I read from a few places that the Model can be passed into ViewModel through its constructor. So it looks something like:
class ViewModel {
private Model _model;
public ViewModel(Model model) {
_model = model;
}
}
Since the View is creating the ViewModel, and to pass the Model into the ViewModel's constructor, then the View has to know about the Model. But from the UML diagrams that I see from most MVVM designs, the View doesn't seem to know anything about the Model.
How should a Model get passed into the ViewModel?