need helps in prism unity regionmanager usage.

Topics: Prism v4 - WPF 4
Aug 22, 2011 at 3:13 PM

Hi, all

I am new to the Unity and prism, and trying to use it in my project but encounter some problems in a strange scenario.

Here is the scenario.

  1. Our project is only to develop a tab page (All functionalities will be on this tab page) as part of a complex hospital application.
  2. The tab page is a desktop wpf control. (User control with the implementation some tab control framework developed by our framework team.)
  3. The tab page will be activate from the top level framework, which is out of our control.
  4. There is no shell at all.

 

Here is the usage of Prism.

  1. I tried to use Unity frame work to do the dependency injections.
  2. I can manage to use bootstrapper to register most of types.
  3. I can get the modulemanager to initialize.

Here is the problem.

  1. Since there is no shell at all, and the RegionManager cannot be set to the tab page (my main wpf control)  I designed, which in turn, I cannot inject any views to the region which I define in the tabpage. the modual is initialized ok, but there is no regionmanager can be used.
  2. I try to create a regionmanager, but it cannot be attached to the main user control. so even I can invoke regionviewwithregion successfully if I create a region myself, the view won't be displayed.

 

Is there any alternative that I can use the RegionManager to link to my first control, and then inject the views later on? How to do it? 

 

Thanks a lot.

Developer
Aug 23, 2011 at 6:08 PM
Edited Aug 23, 2011 at 6:26 PM

Hi,

Based on my understanding of your scenario, first if you are using a regular tabcontrol you can define a region on it. Nevertheless if you are using a control which is not supported by the Prism Library you will have to create a region adapter that suits your requirements.

You might find the following chapter useful, where this topic is explained:

Also this other thread might help you, here you can download a basic example that shows you how to host a Prism Application inside another non-Prism application (i.e. how to have a Prism application in which the Shell is not the main window).

If you still are unable to fulfill your requirements after trying the aforementioned suggestions, it would be helpful if you could provide us with a repro sample application.
I hope you find this information handy.

Agustin Adami
http://blogs.southworks.net/aadami

Aug 23, 2011 at 9:47 PM

 

Thank you so much aadami! I downloaded the code and looked into it, I haven't got chance to try it, but I have a strong feeling that the solution will work for me. (WPF Usercontrol shell.)

Very smart idea. I will keep you posted the news after I apply it to my project

thanks again .