I seem to be stuck. Is there a way to export Appli开发者_如何学Gocation.Current of a Silverlight project using MEF, so that when I load .XAP (my Silverlight component project) file I had access to the App of that .xap?
There isn't really a need for this. Since Application.Current is already a singleton, it's going to exist once your .xap is loaded in any case. You shouldn't need to export it via MEF - your component will already be able to access it directly.
Try this:
Container.ComposeExportedValue(Application.Current);
where Container
is MEF's CompositionContainer
.
精彩评论