Navigating between Views in WPF MVVM

Pranjal picture Pranjal · Mar 22, 2013 · Viewed 7.9k times · Source

I am new to WPF and MVVM and am working on an application which has a few views. Right now I have a View(HomePageView) shown in the shellView's context. Now using a button in the HomePageView I want to load another View in place of the currently shown HomePageView. After looking it up on google, I found something about Event Aggregators. I would request someone to explain the implementation or direct to a good sample application.

Answer

Viv picture Viv · Mar 22, 2013

If your new to WPF MVVM I'd suggest first picking a decent helper tool

There are quite a few options. MVVM Light, Prism, MEF

I'd suggest MVVM light. Simple and easy to get up and running. Prism isnt solely a MVVM Helper but includes features to assist with MVVM. Not done much with MEF myself or things like Caliburn Micro.

As for a sample to explain how navigation between views work with MVVM Light try:

http://www.codeproject.com/Articles/323187/MVVMLight-Using-Two-Views

MVVM Light on CodePlex:

http://mvvmlight.codeplex.com/

^^ link has forwards to some video presentations totally worth watching

Another nice sample using MVVM Light:

http://apuntanotas.codeplex.com/

These should help you get started and you always got https://stackoverflow.com/questions/tagged/wpf for particular questions :)