View First with SL Navigation

Oct 10, 2010 at 9:34 PM

I have come up, possibly, with a way to do "View-First" with SL navigation.  There is an interface called INavigationContentLoader which allows a custom Frame to be created to replace the default one.    So I created one of these which is MEF powered based on some samples of Glenn B from his Mix demo.

When PageLoad gets called, I pull the name out of the URI and use MEF to get both the View, and the ViewModel and then marry them up with Caliburn.  So its actually neither view-first or model-first as neither one creates the other they don't require a reference to each other.

So with this MEF Content Loader, it requires only two lines of code to make it work - an attribute on the ViewModel, and an attribute on the View.  All else is done by the content loader and Caliburn.  So far it works great.  If anyone is interested, I can post a sample somewhere or email me at greg dot gum at gmail dot com.


Oct 10, 2010 at 9:47 PM

Greg, that sounds really cool. This might be exactly the sort of thing for the Recipes section of the site. Would you be interested in writing an article discussing the implementation and its uses? If so, please feel free to send it to me: robertheisenberg at homtail dot com along with the code to make it happen. I'll get it up on the site.

Oct 11, 2010 at 1:48 PM

Certainly, I will have it to you shortly.


Oct 14, 2010 at 9:24 PM

OK, I just sent this to you.


Oct 16, 2010 at 6:47 PM

I just did a blog post on this here as well as putting up the sample app.