I'm trying to figure out why I get an error message about not being able to find the right ViewModel when I'm running my iOS app.
The question I have is when I look at this example I don't understand where MainMenuView gets bound to MainMenuViewModel.
Can someone answer this for me?
Thanks,
PkL728
MvvmCross can locate a ViewModel for a View as long as both members have the same root and suffixes View& ViewModel. In our case, MvvmCross will look for a TipViewModelfor TipView. More notes on this docs to be added!
In MVVM each View needs to be hooked up to its ViewModel. The ViewModelLocator is a simple approach to centralize the code and decoupling the view more.
There is an alternative however. If you don’t use generic parameters, then MvvmCross will make use of some built in “Convention over Configuration” to figure out how to link classes. MvvmCross can locate a ViewModel for a View as long as both members have the same root and suffixes View& ViewModel.
The MVVM Pattern 1 View. The view is responsible for defining the structure, layout, and appearance of what the user sees on screen. 2 ViewModel. The view model implements properties and commands to which the view can data bind to, and notifies the view of any state changes through change notification events. 3 Model. ...
They are bound by class names: for XXXView should be corresponded XXXViewModel
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With