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.
相关问题
- ObservableCollection in ViewModel is not updated w
- Is it possible to send a List<Object> in MVV
- ListView in a metro app does not get its vertical
- cant use store test kit while Working with SQLite
- Windows 8 app (html & Javascript) : alternate way
相关文章
- New Windows Application - What language?
- libxml2 missing for nokogiri gem on Windows 8 x64
- Building Windows 8 Metro App on Windows 7 with Vis
- Difference between Set() and RaisePropertyChanged(
- Windows 8 & MySQL? What are my options?
- How to register a class instance including a param
- MVVM, Confused about ViewModelLocator and DataTemp
- Visual Studio 2012 designer error
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
BindableBase
class (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
Frame
element: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
_navigationService
to the viewmodel. In my case I create the viewmodel in the code-behind of the page:Hope this helps.
The NavigationService that was in MVVMLight has been migrated in a new package called WinRTBehaviors. You can also get EventToCommand in Win8nl, both from nuget. See my blog posted here:
Getting Started w/ MVVM Light for Windows 8, EventToCommand and Behaviors http://blog.tattoocoder.com/2012/08/getting-started-w-windows-8-mvvm-light.html
Read the article published in MSDN Magazine just recently by Laurent Bugnion himself on working with the MVVM Light Toolkit and Windows 8.
Towards the end of the article he explains exactly how to setup the
NavigationService
you need.http://msdn.microsoft.com/en-us/magazine/jj651572.aspx