With Prism, how can I introduce a cloud RegionManager into a service?

I am developing a Prism application and contains TabControlthat contains several child areas. Therefore, I implemented a custom RegionBehavior according to the template described by Brian Lagunas in his PluralSight course, which was found at https://app.pluralsight.com/library/courses/prism-mastering-tabcontrol/ and introduced a custom RegionNavigationContentLoader also described in the above course to make sure that I get no exceptions and that I can have areas of the same name on several tabs of my TabControl.

For those who do not have access to PluralSight:

I implemented a behavior that tracks the Views collection, and when it changes, checks to see if the added view or its DataContext implements a specific interface. If this interface is detected, it sets the cloud RegionManager to a property of this interface, so all views that fall into the area with the region can be aware of their cloud RegionManager.

However, I also have some services that require a cloud RegionManager to navigate to a child region inside my TabControl.

Since I create this service in my container, it gets the global RegionManager, not the region with the region.

My questions:

  • Are there any patterns or structures that allow RegionManagement cloud managers to be introduced into services?
  • 1 - , ?

. , , :

Application Layout

TabControl, , TabItems .

, . , , , ..

VisualisationRegion, , , SettingsGegion.

, .

( , , view/viewmodel. , , , RegionManager, ( , , RegionManager , )

, , , ?

+4
2

. Heck, Viewmodel, , .

  • , RegionManager .
  • , - , . , , , . , , , , . , , .

Update: . , . , VisualizationRegion. . , , .

+3

Brians 2 , ScopedRegionManager.

  • , RegionManager . Action Func , .
  • , ( ), RegionManager:

_

   public static IRegionManager NavigateView(this IRegionManager regionManager, string regionName, string view, NavigationParameters parameters = null)
   {
       var navigationUri = new Uri(view, UriKind.Relative);
       regionManager.RequestNavigate(regionName, navigationUri, parameters);
       return regionManager;
    }
0

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


All Articles