Help with complex MVVM (multiple views)
- by jsjslim
I need help creating view models for the following scenario:
Deep, hierarchical data
Multiple views for the same set of data
Each view is a single, dynamically-changing view, based on the active selection
Depending on the value of a property, display different types of tabs in a tab control
My questions:
Should I create a view-model representation for each view (VM1, VM2, etc)?
1. Yes:
a. Should I model the entire hierarchical relationship? (ie, SubVM1, HouseVM1, RoomVM1)
b. How do I keep all hierarchies in sync? (e.g, adding/removing nodes)
2. No:
a. Do I use a huge, single view model that caters for all views?
Here's an example of a single view
Figure 1: Multiple views updated based on active room. Notice Tab control
Figure 2: Different active room. Multiple views updated. Tab control items changed based on object's property.
Figure 3: Different selection type. Entire view changes