I need to instanciate many instances of the same View of a Prism module. I am using MEF: The Codeplex version has the ExportFactory attribute that allows multiple instance creation but P开发者_Python百科rism uses the .Net desktop version that has not this ExportFactory attribute. I tried to make Prism work with the CodePlex version but it seems this is not possible..
I found the Composition.Initialization.Desktop thing but I did not succeed in using it.
Any other ideas ?
You can use the PartCreationPolicy attribute and set it to NonShared.
Or, you could also Export and Import a factory class that you then use to build the desired class.
The next version of MEF for the desktop will have ExportFactory. You can download a preview from the MEF CodePlex site, which has support for ExportFactory on the desktop.
精彩评论