pnavk
pnavk

Reputation: 4630

MvvmCross Xamarin.iOS Bindings: How does MVVM cross know what property to bind against?

So I have been experimenting with MvvmCross and I came across the following syntax to create a binding:

this.CreateBinding (GenerositySlider).To ((TipViewModel vm) => vm.Generosity).Apply ();

In that code sample, GenerositySlideris a UISlider in iOS.

I know I can specify a specific property to bind against using the For method. But this code works and the framework knows to bind against the Valueproperty on UISlider.

How does MvvmCross know to bind against the Value property on UISlider?

If its defaulting to a specific value for various controls, is there documentation on what property it will default to?

Thanks!

Upvotes: 2

Views: 247

Answers (1)

pnavk
pnavk

Reputation: 4630

I figured it out. Posting here incase others are curious:

MvvmCross defines classes for targets that define a default property to bind against. So for the UISlider scenario above, it uses the MvxUISliderValueTargetBinding class to determine what to bind against.

I couldn't find documentation on which property Mvx will default to for various controls, but here are all the available TargetBinding classes for iOS: https://github.com/MvvmCross/MvvmCross/tree/4.0/Cirrious/Cirrious.MvvmCross.Binding.Touch/Target

Upvotes: 3

Related Questions