MVVM Cross Notes

MVVM Cross Android

MVVM Cross Android Binding



<?xml version="1.0" encoding="utf-8"?>
  <declare-styleable name="MvxBinding">
    <attr name="MvxBind" format="string"/>
    <attr name="MvxLang" format="string"/>
  <declare-styleable name="MvxControl">
    <attr name="MvxTemplate" format="string"/>
  <declare-styleable name="MvxListView">
    <attr name="MvxItemTemplate" format="string"/>
    <attr name="MvxDropDownItemTemplate" format="string"/>
  <item type="id" name="MvxBindingTagUnique"/>
  <declare-styleable name="MvxImageView">
    <attr name="MvxSource" format="string"/>

Data Bindings


This binding mode transfers values in both directions
Changes in both View and ViewModel properties are monitored - if either changes, then the other will be updated.


  • This binding mode transfers values from ViewModel to View
  • Not very commonly used, but can be useful for fields which are configurable but which don't tend to change after they have initially been set.
  • One-Time binding when setting static text from language files - this is because it's common for the user to select a language, but once chosen, it's uncommon for the user to then change that language.

Data Binding

2 way Data Binding Syntax using MVVM Cross and Android

local:MvxBind="Text SubTotal"

What this line means is:


the property Text on the View to the property SubTotal on the DataContext - which in this case will be a TipViewModel


whenever the TipViewModel calls RaisePropertyChanged on SubTotal then the View should update and whenever the user enters text into the View then the SubTotal value should be set on the TipViewModel

this is TwoWay binding

details and original tutorial


How to make Visual Studio IOS Designer and MVVM Cross Work together

  • instead of modifying the .xib files in Xcode, you can use the VS Story Board Designer using the 2nd method listed in this post.
  • An .xib editor for visual studio is coming by Xamarin in the future