DoctorMick wrote:
Obviously, my ViewModel should know nothing about the view so I can't do it there, can I?
There could be a few ways to handle this. An easy approach would be to use the navigational framework. But this does not provide the decoupling you are talking about. You cannot let your viewmodel know about the new view that you would want to launch, but you can let it know about the viewmodel for it. Create an instance of the view using the viewmodel. All this is based on the assumption that you are using the "viewmodel first" approach while implementing MVVM. If you want to decouple a little more than that, use a common controller class that handles all view / view model creations - this way all your view model knows about is this common controller class - nothing else. A fourth approach could be to use the EventAggregator pattern implemented by Microsoft Prism. Prism provides very high level of decoupling, but then there is a learning curve attached to the features it provides.
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest.
Honestly. It's the honest ones you want to watch out for...