Sep 21, 2012 at 8:36 AM
Edited Sep 21, 2012 at 8:41 AM
I am new on developing silverlight with Prism.
I already made some reseach on how to my problem with the region and subregion with multiple instance of same view to the tab region but still I can't find the answer.
I have main project module with 1 View and has TabControl as a prism region.
Then, I have separate sub projects module with a view and inside of the view it also has a region.
The way I call the sub project module is using requestnavigate.
_regionManager.RequestNavigate("TabRegion", New Uri("Module1", UriKind.Relative), AddressOf NavigationCompleted)
Whenever I use the RequestNavigate to call the view of the sub projects, it is add to the tabitem of the main project module. This is working. But when I call again the navigaterequest to add the view of the sub project module that is already added on the tabitems,
instead of create a new tab and instance of the view, it prompts an error like this.
"An exception occured while creating a region with name 'exampleregion'. The exception was: System.ArgumentException: Region with the given name is already registered".
I read from one of the article, I need to use the injection of view to have multiple instance of the view and put different name of the view.
Dim mainRegion = RegionManager.Regions("TabRegion")
mainRegion.Add(new OrderDetails(), "OrderDetails1")
mainRegion.Add(new OrderDetails(), "OrderDetails2")
I can't use this code to the main project module to call the views of the sub project module. The main project module cannot find the views of the sub project module because it is on separate project. In the example above, the OrderDetails cannot be find
on the main project module because it is located on the sub project module.
Normally, my sub project module register its view on the moduleinit like the example below and I can call it to the main project module using requestnavigate.
Public Sub Initialize() Implements Microsoft.Practices.Prism.Modularity.IModule.Initialize
_container.RegisterType(Of Object, SubModuleView)("SubModuleView")
I hope someone can help on how I can solve my problem.
Here is my sample project
https://www.dropbox.com/s/pe5y31iuhpg9h9y/TestProject.zip that has similar problem.