简体   繁体   中英

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, GenerositySlider is 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 Value property 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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM