I just started developing my brand new windows 8 application last week using mvvm light.I am familiar with mvvmlight WP7 navigation. How i can achieve the same in windows 8. Can any one suggest a better method to achieve the same in windows 8. I found a solution, where we override onnavigated events in vm and handle navigate to other page. But i think that method is obsolete. Any one please guide me with the proper implementation. Thanks in advance.
I just started developing my brand new windows 8 application last week using mvvm
Share
I understand this is not the exact answer you may be looking for, but this may give you some ideas to explore.
In my case, I’m not using MVVMLight – but my own simple MVVM implementation. I use the
BindableBaseclass (which comes with the default VS 2012 RC templates) for property notifications. I imagine, you could use MVVMLight to give you some of the infrastructure, which you can complement with something like the below.For navigation, I define an interface that looks like:
And implement it as follows:
IView:
IViewModel:
Finally, in the XAML page, define a
Frameelement:And in the code-behind of the page: (this in the only ugly part in my opinion – but its hopefully not too bad):
You can now pass the
_navigationServiceto the viewmodel. In my case I create the viewmodel in the code-behind of the page:Hope this helps.