What do you get from composite models? Are these properties that you want to wrap in separate viewing models really complicated? As in the case, will there be scenarios when you need a bit of more complex modifications / processing, say, MainViewModel.PropertyX
?
If your properties come down to simple values ββthat you can set or not, introducing new view models for them sounds too far away. Keep it as simple as possible.
However, if it makes sense to edit parts of your document out of context (for example, away from the document from which they come, for example, address information), or several sets of similar fields, then it may be worth wrapping them in a general view model. Save you some redundant work.
Prism, MVVM Light ..?
If your application is as simple as several kinds of viewing models, I would stay away from Prism. This is a rather heavy and rather complex structure. On the other hand, MVVM Light can be a worthy idea, even for the sake of learning.
Edit:
Given that your model is quite huge, it makes sense to separate it. I also suggest creating dedicated view / view pairs for objects that consist of your main entity (document). Linking to models may seem attractive, but more often than not you will regret this decision. Simply put:
- a shared view model for objects where it makes the most sense (it can go with everyone, but usually it is a call of judgment - "Do I really need a new view model for this object that displays a single-row property?")
- Separated views corresponding to model types.
- main view model (document) displaying models with partial representation as binding properties
- main view partial views of DataContexts for partial viewing of models taken from the main one.
source share