I have a ViewModel that can create another ViewModel.
I want to set this ViewModel as the data context of existing View, then Navigate to that View.
In MyViewModel
private void CreateNewOrder()
{
var order = new OrderViewModel(new Order(){/* setup some things */});
// another ViewModel subscribes to MyCustomEvent
this.eventAggregator.GetEvent<MyCustomEvent>().publish(order);
this.regionManager.RequestNavigate("DetailRegion", new Uri("OrderView", UriKind.Relative));
}
The problem is ...
- My ViewModel needs reference to the region's name, and the View's name.
- "DetailRegion" must contain the "OrderView" object.
- DetailView.DataContext is set to OrderViewModel (using aggregate event subscription)
Is this tight coupling?
I've spent sometime looking in the Prism Quickstart project and found the "Controller" or something that is too complicated.
I just want to simplify decoupling View-ViewModel.