Skip to content
Sasa Sekulic edited this page Mar 30, 2016 · 1 revision

Oh noes, it doesn't work!!!

Ok, stop whining. Here's how to quickly debug the viewbindings:

  1. Check that the binding string in the widget is correct: you start a binding declaration with { and close it with }. If you want to put more of them, put ; between them. Don't forget to enclose them in ". Check that the bound widget property is correct (e.g. Text, Color etc.). Check that the binding command is correctly written (- for one-time binding, = for continuous binding; @ on one or both sides; when in doubt, just put = and it should work).

  2. Check that the binding type is correct - don't use one-time setting methods - if you don't have a value ready at ViewModel creation time. If the widget or bound data don't get updated, and you expected them to, make sure they use = for the continuous binding. Also,

  3. Check that the declared bound property/method corresponds to the property name or properly-prefixed method name (is, get, set for values, can & do couple for commands + declared name).

  4. Check that the value is either set by the time the binder makes a pass (it's initialized when instantiating a ViewModel) or you have to call raisePropertyChanged when set later.

  5. Check that you're actually inflating the view manually with the custom ViewBinder and ViewModel - and that you're setting the resulting view as the base view using setContentView().

  6. If using multithreading, check that you called the raisePropertyChanged from the UI thread.