Switch between views in different modules using Prism and Unity

I am making proof of the concept of a WPF application with Prism 4 and Unity, but I am having some basic problems.

In our solution, we have the following projects:

-AppName.Desktop -AppName.Modules.ModuleA -AppName.Modules.ModuleB 

Following some teaching aids, studied some examples and searched the Internet, I could not find a suitable answer to a very elementary question; how can i switch between two views in different dlls .

The first view (ModuleAView) is loaded in the Initialize ModuleA method:

 public void Initialize() { regionManager.RegisterViewWithRegion("MainRegion", typeof(Views.ModuleAView)); } 

When I click on the ModuleAView button (or on the button in ModuleAView), I want to switch to ModuleBView.

 public bool SomeEventInModuleAView(SomeEventParams e) { Uri viewNav = new Uri("ModuleBView", UriKind.Absolute); regionManager.RequestNavigate(RegionNames.MainRegion, viewNav); } 

Obviously, this will not work, because ModuleA does not know where to find ModuleBView. I read about changing the URI with a package / application / component, etc., but I can't get it to work.

I thought something like this:

 Uri("pack://application:,,,/AppName.Modules.ModuleB;component/Views/ModuleBView.xaml", UriKind.Absolute); 

Since loading modules from different assemblies is one of Prism’s goals, I think it’s strange that there are no examples in Prism loading to show how this works.

+4
source share
1 answer

I have found the answer. I completely forgot to register a second submission.

Check out the solution here: http://compositewpf.codeplex.com/discussions/402860#post940396

+3
source

Source: https://habr.com/ru/post/1445511/


All Articles