Create your ViewModels
First we're going to create a couple of base classes for our PageViewModels and ViewModels. It's not necessary, but it makes life much easier if we later on want to insert our own base class functionality. If you do not wish to do this then you can simply derive your ViewModel
classes directly from the library implementations (or not - MvvmZero
does not require you use its base classes)
In your Mvvm/PageViewModels
folder, add the following abstract
class:
Similarly, in your Mvvm/ViewModels
folder, add the following abstract
class:
Now we want to create a ViewModel
for each of the ContentPages
. In the Mvvm/PageViewModels
folder, add ReadyPageVm
Make the class public
and derive from our base implementation for a PageViewModel
:
Repeat the process for SteadyPageVm
, GoPageVm
and DetailPageVm
And here we are:
Next we're going to register our Pages
and ViewModels
so they can be presented.
Last updated