Sponsored By Aspose - File Format APIs for .NET

Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!

View Model Locator – MEF Style

At MIX, Laurent Bugnion and I had a brainstorming chat around improving on the ViewModel locator “pattern” through the usage of a MEF generic locator that allows binding via indexer properties thus removing the need for a hard-coded locator. Tonite John Papa pinged me with a similar thought. Next thing you know we paired up for about 40 mins…and Voila, Success!

Caveat: We hit a binding bug on SL4 that made it a little uglier than it needs to be through requiring a converter. Hopefully that will be fixed soon.

Go read about it on John’s blog!

This entry was posted in MEF, MVVM, silverlight. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Mike Lavery

    I would also like to see a WPF version. A co-worker and I were investigating and had the same results. It would be very helpful with my application.

  • Roger

    The locator works great for SL. However, since WPF is missing MEF’s Composition Initialization, it doesn’t compile for the desktop. I grabbed your WPF port of these assemblies (http://cid-f8b2fd72406fb218.skydrive.live.com/self.aspx/blog/Composition.Initialization.Desktop.zip) and plugged them in to get it to compile. However, I can’t, for the life of me, figure out how to make it work. The Lazy case (shared) works fine. But the ExportFactory (non-shared) case doesn’t ever get any results. I suspect it’s because I’m not calling those four magical setup lines in the proper way. Any chance of getting a WPF port of the ViewModel locator?