I couldn't find a list of all type of binders available for use, recently a collegue found about local:MvxBind="Visibility Property" and that helped a lot with our code. I belive that MvvMCross has a lot of hidden gems that we don't know yet. Is the information available somewhere?
Binders that we know:
- local:MvxBind="Text Property"
- local:MvxBind="ItemsSource Property; SelectedItem Property"
- local:MvxBind="Click ICommandProperty"
- local:MvxBind="ItemsSource Property; ItemClick ICommandProperty"
- local:MvxBind="Visibility Property"
Thanks!
Automatic Property Binding
MvvmCross binds to C# properties on native Views - so any public C# get/set property exposed by Xamarin.Android can be one-way bound to.
Further, if the property
Foo
is accompanied by an event of signaturepublic event EventHandler FooChanged
then MvvmCross can two-way bind to it.Automatic Event Binding
MvvmCross also binds to any
public
C#event
s which are exposed by native views - as long as they haveEventHandler
signatures and notEventHandler<SomeSpecialArgs>
These can be automatically bound to
ICommand
callers (the action is automatically bound to theExecute
handler, but nothing is automatically bound to theCanExecute
).Custom Binding
Beyond these straight-forward properties, MvvmCross also has facilities for "custom bindings".
The list of "custom bindings" that MvvmCross supplied by default is in
FillTargetBindings
in AndroidBindingBuilder - https://github.com/MvvmCross/MvvmCross/blob/v3/Cirrious/Cirrious.MvvmCross.Binding.Droid/MvxAndroidBindingBuilder.cs#L79A couple of the plugins (notably
Color
) also add their own bindings.For information on adding your own custom bindings, see http://slodge.blogspot.co.uk/2013/06/n28-custom-bindings-n1-days-of-mvvmcross.html
The N+1 topics on MvvmCross custom controls, on animation and on maps are also worth watching - they provide alternative mechanisms to custom bindings.
For more on MvvmCross binding, see https://github.com/MvvmCross/MvvmCross/wiki/Databinding