views:

109

answers:

2

Hi there,

I've a list of usercontrols which I've had imported via ImportMany Attribute. See the following code segment :

[ImportMany]
private List<Lazy<IUserControl, ILinkerMetadata>> UserControlsMetaData { get; set; }

So if I add each Lazy data record to a e.g. combobox, the data record won't be load, because it's tagged as Lazy (consequential! :-))

Now, my question - whats the opposite of Lazy?. I couldn't import the metadata to a dictionary like this :

[ImportMany]
private Dictionary<IUserControl, ILinkerMetadata> UserControlsMetaData {get; set;}

Thanks in advance,

patrick

A: 

You have to import into a Lazy if you want to get the metadata. When you access the Value property the control will be created, so you may want to add the Values to your ComboBox.

Daniel Plaisted
A: 

you can try ExportFactory. its more or less the opposite from lazy in some way :) ExportFactory is not built in for wpf so you have to look on mef.codeplex.com there is the sample project.

blindmeis