Navigation for WPF Using ViewLocator - Need Help

May 24, 2011 at 7:42 PM

I just started using the toolkit and have a basic application running in WPF.  It uses the ViewLocator.  The individual views render fine as are the bindings with the ViewModel.  Where I am stuck is the navigation piece.  I have gone through the sample navigation project but it is in Silverlight and does not incorporate the ServiceAgent or ViewLocator.  Does anyone have a sample of navigation for WPF?

 

Thanks for your help.

May 27, 2011 at 2:58 PM

Hi there. If you start a new project in Visual Studio by selecting the SimpleMvvmWpf project template (under Windows, Mvvm), then you'll get a WPF project that includes both a ViewModelLocator and a ServiceAgent.

In terms of navigation, I believe that Silverlight and WPF navigation models are quite similar.  To see how to do navigation with the toolkit for Silverlight, there is a Navigation sample installed in the Samples folder (under Program Files (x86)\SimpleMvvmToolkit), under SimpleMvvm-Other\SimpleMvvm-Navigation.  I have some info on navigation here: http://blog.tonysneed.com/2011/03/03/climb-onboard-on-the-mvvm-message-bus.

Cheers,

Tony

May 18, 2012 at 4:30 AM

Hi Tony,

 

I am also a newbie in mvvm.  Can I ask for a favor? could you please give us an example on how to navigate using WPF?  

 

thank you and God bless!

 

Joel

May 18, 2012 at 12:33 PM
Hi there, These are pretty good examples:


Cheers,
Tony
May 18, 2012 at 6:04 PM

Hi Tony!

 

Thank you very much for the help.  But i would also want to know how to navigate if my view is not a page class? such as user control?  would you mind if you can give me another example? thank you!

 

best regards,

 

joel

May 18, 2012 at 7:14 PM
I believe the view needs to be a Page. If not, wrap it in a Page.