Replies: 2 comments 6 replies
-
@td3466 based on your title alone what you are asking "How do I drink water from a glass of Coca Cola?" Prism.Unity is an implementation of the IContainerExtension using the Unity Container. Now you do have the ability to further customize the behavior of the Unity Container and pass that into the the UnityContainerExtension, however that is 100% not the same thing as adding a custom container as defined by the docs that you referenced. If your goal is to add a custom container then you should be referencing Prism.Wpf and NOT Prism.Unity. Keep in mind that for Prism to work correctly we additionally ensure that the settings of the underlying container will:
|
Beta Was this translation helpful? Give feedback.
-
Hi @dansiegel, I am very appreciate to use Prism in WPF Apps (started use Prism a long time ago, I guess more than 7 years ago). I faced with the same issue what described here and I will be very glad to see support immutable container out of the box. What do you think? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm wondering if someone can point me in the right direction.
I have been following this link as best I can to use a custom container with Prism (https://prismlibrary.com/docs/dependency-injection/add-custom-container.html).
I'm not an expert, but what I'm finding is that when doing this, I need to register some classes manually with the container from the RegisterTypes method (mainly the RegionAdapters and the Behaviours) otherwise an exception is thrown saying the type doesn't exist in the container (if there might be a cleaner way to do that please let me know).
After all the types are manually registered so there are no more exceptions, it displays the Shell. The Shell has 3 regions defined, 1 for a ribbon accross the top, 1 for a statusbar accross the bottom and 1 for a main content area (I'm not trying to load the actual controls for these regions just yet, haven't gotten that far).
What I find is that only 1 region is actually created in the RegionManager when the Shell Window is shown, and only the one for the last control defined (ie: statusRegion in the xaml exerpt above).
if I use the default container (Ie: Unity), all 3 regions are created in the RegionManager; is there a type that may not be registered in the DI container?
I have tried Prism.Wpf and Prism.Unity nugets, and get the same result. I have tried using the regionManager.RegisterViewWithRegion from the Shell constructor to no avail. I have also tried regionManager.Regions[regionName].Add(view) but because the regions don't exist that throws an exception. I tried debugging the code, but it's a bit too advanced for me (I got stuck trying to follow it through the DelayedRegionCreationBehavior class).
Any thoughts as to what I'm missing? Any help greatly appreciated.
Troy.
Beta Was this translation helpful? Give feedback.
All reactions