WPF Prism: Can you load modules as needed on the fly?
I know that with Prismv4 / MEF you can load modules without including them in your bootstrapper, but could I load modules on the fly as needed? That is, I have a menu of forms:
- Form 1 (Located in Form1.dll)
- Form 2 (Located in Form2.dll)
- Form 3 (Located in Form3.dl开发者_StackOverflow社区l)
Then, only when someone clicks Form 1 does it load the Form1.dll as a module, etc.
Yes...load modules on demand.
You essentially need a reference to the IModuleManager
. With this you can call...
IModuleManager manager = //get this via DI within a constructor perhaps...
manager.LoadModule("ModuleName");
精彩评论