I have a WPF application where the entire application functionality is put inside tabs. Much like web browsers, every tab is one instance of the actual application.
Right now I have a view model for the entire application window MainWindowViewModel, but I am wondering if it’s okay to make that view model to have an observable collection of those tab view models?
Yes, that approach sometimes makes sense in exactly this type of scenario. When you have a collection of list items that are views in their own right, nesting viewmodels makes it easier to determine which list item you’re working with at any given time.
If the collection was just a set of simple objects with a couple of properties, it wouldn’t be worth the overhead of dealing with extra viewmodels.
However it sounds like each of these tabs will have some behavior of their own and the individual viewmodels are appropriate.
It does add some complexity if you need to communicate between viewmodels, though. If you’re not already using some kind of event aggregator, you may need to head down that path at some point.