I am going to try my best to explain the problem in detail.
I am using WPF, MVVM and PRISM. Here is the structure of the app:
CONTAINER
User control containing a toolbar
---------- LEFT PANE USER CONTROL
right pane
user control
----------
---------------------------------------------------------------
The Container is a Shell which host the look of the application. The Shell also contains many different user controls like User user control, Role user control, Categories user control. All of the controls are collapsed.
The toolbar has options like Save, Edit, Delete. When the user selects the Edit option from the toolbar then I use the WPF commands to call the Edit method on my ViewModel as shown below:
private void Edit(UserViewModel userViewModel)
{
// load the edit page
}
The toolbar.Datacontext is set dynamically to the datacontext of the user control which is a viewmodel. So, the same toolbar can be used with different context to invoke commands on different viewmodels.
At this point I already get the correct UserviewModel passed in the Edit method. This is all fine! But now! I need to update the details pane to reflect the EditView. How can I do that? All the controls are embedded in the Shell.xaml file collapsed. Also the ViewModels are in a separate assembly and Shell is in a separate assembly.
This is where I need help! How can the viewModel who has no idea about the Shell since (Shell references the ViewModel assembly not the other way around) can inject an EditView into the Shell details pane.