I'm a junior developer who recently got looking into WPF/MVVM and now after a good few months I'd say I'm a half decent WPF dev who can use the MVVM pattern well. Now I've stumbled onto Prism which drew me in because of some of the nice features it offers. However, after starting a practice application to test the Prism library I have hit some walls which were never a problem when using regular old WPF/MVVM. My main question:
What is the best way to allow communication between parent and child view models using Prism?
When I say communication, I mean allowing a parent view model such as 'Address Book VM' to access a child view model such as a 'Person VM' and all of its properties... as this is what I have been taught to do. I would have accomplished this by having a child view model property in the parent view model and then simply using a content control in the view and setting it's datacontext to the child viewmodel. From this I have a hierarchical structure where the parent can access the childs properties or the child can use a command in the parent etc.
However, when using Prism to instantiate View Models I use the ViewModelLocator - this finds the view model for us and instantiates it. Using this method there is no child property referencing the view model in the parent meaning the parent doesn't have easy access to the childs properties and vice versa. Is there an easy solution to this?
Now if anything you've read sounds fundamentally wrong concerning the use of Prism or the MVVM pattern then please inform me - I'm all ears. There's a good chance that I'm approaching everything in an incorrect way.