Issues on View/ViewModel Binding when using Navigation Template

Oct 14, 2010 at 2:47 PM

Hi Jeremy.

I am evaluating your MVVM framework, very interesting indeed, using a sample app built using standard Silverlight navigation template.

It seems that Jounce mechanism to auto-bind views and viewmodels doesn't work if views are actually Navigation Pages.

Debugger shows that despite "Binding" property on view is actually called (with getter implemented as return ViewModelRoute.Create("HomeViewModel""HomeView")), ViewModel instance is never created.

Of course, implementing ViewModel creation and DataContext assignment explicitly in View's XAML works as expected:

<UserControl.DataContext>
        <vm:HomeViewModel />
</UserControl.DataContext>

Is there any workaround?
Thanks,

Lorenzo Maiorfi - Innovactive Engineering s.r.l.

Coordinator
Oct 14, 2010 at 3:14 PM

There is - that is one of the quick starts I will work on. It doesn't come up as much in my applications because many enterprise customers treat it as an application, like on the desktop, that is delivered over the Internet, as opposed to a "richer set of web pages" that make more sense with the navigation paradigm.

It will work, and I will post a quick start, but in essence, you'll do this:

(1) Create a JounceNavigator.xaml view with one ContentControl region (or, if you want to animate between pages, one ItemsControl region).

(2) Map all URIs to the JounceNavigator.xaml

(3) Instead of creating pages, create UserControls.

(4) When JounceNavigator is navigated to, you can inspect the Uri and raise the corresponding control event and it will map into the region.

This was lower on my list of priorities, but I will definitely do it - if others are struggling with this specific paradigm, please reply here and I will bump it on the priority list (next item was going to be the CRUD example with the entity view model).

Oct 14, 2010 at 10:53 PM
Edited Oct 14, 2010 at 11:02 PM

I would also like to see an example of how navigation would be handled with the Jounce Framework.  More specifically how you would normally use Uri Mapper and the Frame Control ( with modified template using ContentTransition control) to add page navigation animation, how this same functionality could be accomplished using Jounce.