I have quite a large number of parent-detail ViewModels in my MVVM application. Something like this:
SchoolsViewModel
+- SchoolViewModel
+- LessonViewModel
+- PupilsViewModel
+- PupilViewModel
+- TeacherViewModel
+- PupilsViewModel
+- PupilViewModel
+- LessonsViewModel
+- TeachersViewModel
And so on...
In addition, a single view model can appear in more than one place, depending on whether the user is browsing by lesson or pupil, etc.
How would you allow for sharing of child ViewModels between different parent ViewModels? For example, "Pupil A" will be present in the highest-level PupilsViewModel and also in a number of PupilsViewModels contained within LessonViewModels. Would you create multiple PupilViewModel objects referring to the same data model? Or somehow locate an existing view model for the data model?
This question has another related question: MVVM and StructureMap usage