Slide 1

Slide 1 text

Custom Bindings

Slide 2

Slide 2 text

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!

Slide 3

Slide 3 text

Needs Custom 1 Non-standard EventHandler MyControl MyValue MyValueChanged

Slide 4

Slide 4 text

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