I'm just beginning a new WPF project in which we're hoping to use Caliburn.Micro.
At this stage I'm just a little confused about how Views and ViewModels can be divided up and composed.
Our interface is going to be one big treeview (plus a details panel, but ignore this for the time being) with which you navigate and operate on all the different business objects we have - basically, something like Windows Explorer. At first I was imagining
that we would end up with one View, because I mentally equate a view with a physical screen.
However, in terms of dividing up work and responsibility, I can see that it could make sense to have lots of different ViewModels, one for each kind of object that will be in the treeview. This way, each ViewModel can concentrate on its own business object,
without having to worry too much about others. For example, consider a tree structure that contains Customers, Customers contain Orders, and Orders contain Items. We could have separate ViewModels for Customer, Order and Item.
Given that ViewModels are just normal classes, we can then compose these ViewModels - eg, the Person ViewModel can have a list of Order ViewModels, etc.
But, it gets confusing to think about how this relates to the Views. Each ViewModel should have a corresponding View ? Given everything is ending up on the one screen in the same treeview, is it possible to make 3 separate XAML Views, and somehow compose
these ? Or should we just have one View, which somehow makes use of the 3 ViewModels ?
If in contrast to a treeview, for example, when you clicked on a person, a separate window opened to show all the orders for that person, it's much easier to envisage that as a separate view.
Hope this makes sense - let me know if it doesn't, so I can clarify if necessary.
So basically, in general, what is the usual way of thinking about the structure of ViewModels and Views in this kind of situation ? ie, displaying lots of different kinds of things on the one screen.
Any advice is greatly appreciated ! Are there any good examples out there I could look at ?