Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Create a common interface/class known to both module, called IChildWindowService, register the IChildWindowServe/ChildWindowService in the bootstrapper.</p> <pre><code>//Highly simplified version //Can be improved by window reuse, parameter options, stronger eventing public class ChildWindowService : IChildWindowService { public ChildWindowService(IServiceLocator container) { _container = container; } public void Show&lt;TViewModel&gt;(TViewModel viewModel = null, Action&lt;TViewModel, bool?&gt; callBack = null) where TViewModel is IViewModel { var viewName = typeof(TViewModel).Name.Replace("Model", string.Empty); // In bootstrapper register all instances of IView or register each view one by one var view = _container.GetInstance&lt;IView&gt;(viewName); viewModel = viewModel ?? _container.GetInstance&lt;TViewModel&gt;(); view.DataContext = viewModel; var window = new ChildWindow(); window.Content = view; var handler = (s,e) =&gt; { window.Close(); } viewModel.RequestClose += handler; view.Closed += (s,e) =&gt; { viewModel.RequestClose -= handler; } // In silverlight all windows show as Modal, if you are using a third party you can make a decision here window.Show(); } } </code></pre> <p>Create a common CompositePresentationEvent, this event will pass the parameters from point a to point b </p> <p><code>public class OpenChildWindowWithParameters : CompositePresentationEvent&lt;ParamEventArgs&gt;{}</code></p> <p>The ViewModel in Module A raises the Event. The Controller in Module B registers and reacts to the Event. The Controller in Module B takes the child window service as a dependency. When the event is raised the Controller will create the VM in Module B and pass the parameters to it, from the event, it will also use the Service to display a ChildWindow.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload