I dont understand how to use Regions in Prism correctly. For example, I have an application: Structure of my app I only have one ShellView (window) and ShellViewModel as DataContext (but it is not important). My problem is OrderView (each OrderView is separate window), that splitted on few regions (for example: Region1, Region2, Region3). For each region I use UserControl by injecting through modules (IModule), but I don't understand how I should use bindings for that.
I have few variants:
- Use separate view-model for each region
- Use one view-model for view and use it by regions (I think that is simplest way, but incorrect, because regions wiil be strongly linked with this view-model)
- Or something else
For variant 1: I creating OrderView by special service (code example from service):
OrderView view = IoCHelper.Resolve<OrderView>();
OrderViewModel ovm = view.DataContext as OrderViewModel; //(or using special property for that: view.ViewModel)
ovm.Data1 = ...;
ovm.Data2 = ...;
view.Show();
I don't understand how I can send other view-models for regions
My problem is that I dont know how to correctly transfer data from OrderViewModel to regions (without strongly linking region's controls to this view-model (because that controls can be used in other part of application with other view-model))
(sorry for my sometimes incorrect english)