On my master view model I am publishing an event with the contents that I want to pass to the detail.
ViewSettings storeViewSettings = new ViewSettings();
storeViewSettings.ViewName = ViewNames.CurrencyDetailView;
storeViewSettings.RegionName = RegionNames.SecondaryRegion;
storeViewSettings.CurrentItem = viewData.CurrentItem;
A control is subscribing to the event and activates the correct view.
private void DisplayView(ViewSettings viewSettings)
this.ViewSettings = viewSettings;
string viewName = viewSettings.ViewName;
// Default to the main region if no region was specified.
viewSettings.RegionName = RegionNames.MainRegion;
// Check to see if the region exists.
IRegion region = this.regionManager.Regions[viewSettings.RegionName];
object currentView = region.GetView(viewName);
// If the view already exists in the region remove it.
if (currentView != null)
// Get a new instance of the view.
currentView = ServiceLocator.Current.GetInstance<IView>(viewName);
catch (ActivationException activationException)
logger.Log(activationException.ToString(), Category.Exception, Priority.High);
// Add the view to the region.
// Activate the view.
My values are injected with the constructor and everything works.
public CurrencyDetailViewModel(IGeneralController generalController)
this.generalController = generalController;
this.currency = this.generalController.ViewSettings.CurrentItem as Currency;
When I send a second value from the master view model, the detail view model's constructor is not called and my data is not changed..
What do I need to do set my values every time or have the constructor injected every time?
I have tried to follow TransactionInfo from the StockTrader example but I still cannot seem to figure it out.