Data-Binding to ‘Controls’
MyControl
MyValue
MyValueChanged
CreateBinding
.For(view => view.MyValue)
.To(vm => vm.Name)
As long as MyValueChanged is EventHandler, should just work!
Needs Custom 2
Non-Standard Event Name
MyControl
Foo
BarHappened
Slide 5
Slide 5 text
Custom PropertyBased Binding
Create a PropertyInfoTargetBinding:
Register it in Setup:
Slide 6
Slide 6 text
Needs Custom 3
No actual property
MyControl
GetFoo()
SetFoo()
BarHappened
Slide 7
Slide 7 text
Full Custom Binding
Create a full custom TargetBinding:
Register it in Setup:
Slide 8
Slide 8 text
WARNING
iOS UIKit Memory Management is Hard!
Slide 9
Slide 9 text
WARNING
Watch out for event loops
Slide 10
Slide 10 text
Alternatives…
You can always directly use:
– FindViewById or [Outlet]s
With:
– ViewModel
– ViewModel.PropertyChanged
But:
– The same warnings apply!
Slide 11
Slide 11 text
Sample
Shown in only a couple of apps…
https://github.com/slodge/MvvmCross-
Tutorials/tree/master/CustomBinding
https://github.com/slodge/MvvmCross-
Tutorials/tree/master/Sample%20-%20CirriousConference