views:

935

answers:

3

What is the best approach for navigating between UserControls/Pages(out of browser experience)? I'm fairly new to Silverlight and even newer to the mvvm pattern.

How well does the Navigation Framework Integrate with the MVVM Light Toolkit? A snippet for general application flow control with the two would be great.

The plan was to use the Navigation Framework for general flow or using Jeremy Likeness's approach to region management(http://csharperimage.jeremylikness.com/search/label/regions) and swapping out regions as needed. I've seen a few places mention replacing the Visual Root, but that sounded like a hack to me.

Any advice, snippets, or a nudge in the general direction would be greatly appreciated.

Thank you.

A: 

I'm struggling with the same thing, However, I am kinda steered away from the "NavigationService" because allegedly the journal keeps the object reference in memory or something I read somewhere.

I've been trying to utilize a frame in the main window, and using mvvm light to send navigation messages to the window to change the frame.

Edit: I figured it out.

In the main window (code behind, not viewmodel) I added a Messenger.Default.Register(Of NotificationMessage(Of NavMsg))...

Then in ANY view model I do a Messenger.Default.Send(Of Notificationmessage(Of NavMsg))...

And then I created a NavMsg class which accepts a string uri or an object to navigate to.

Here's some T4 code templates to generate you the code for your view/viewmodel to work with mvvmlight and it demonstrated the closing window message above. http://bit.ly/auMxfx

Rick Ratayczak
Excellent I'm hoping to slice off some time today or tomorrow to take a look. By the way nice multi-touch table:)
deliberative assembly
+1  A: 

You may find the following post useful: SL4 Navigation Template with MVVM Light

john_man
Excellent thank you.
deliberative assembly
A: 

I had the same problem and found this link (applies to Silverlight too):

Windows Phone 7 — Navigation between pages using MVVM Light Messaging

AlexB