开发者

How can I create a Wizard interface from code injected via MEF?

开发者 https://www.devze.com 2023-03-31 02:05 出处:网络
I would like to write Wizard on the basis of MVVM, MEF. I would like that each page of the Wizard was loaded from separate dll (MEF).

I would like to write Wizard on the basis of MVVM, MEF. I would like that each page of the Wizard was loaded from separate dll (MEF). I found this excellent article about creation of the wizard, but unfortunately in this ar开发者_运维技巧ticle is not written as to use MEF for addition of pages. I want to make the wizard just as described in the article but I can't think how to export page of the wizard using MEF.


I wrote a simple application to illustrate my problem. This solution contains two assemblies.

How can I create a Wizard interface from code injected via MEF?

How can I get a fully-formed page from the assembly WpfApplication4.Library in WpfApplication4.

I mean PageView with installed PageViewModel.

Mef


The article describes having a list of viewmodels, you could define a contract for your pages IWizardPage for example and then import such a list using the ImportMany attribute:

...
[ImportMany]
IWizardPage[] Pages{ get; set }

(the actual IWizardPage interface can be empty if you want)

Then you can add those pages like the article describes to the actual wizard main window

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号