1
votes

I am trying to bind the TextColor property on a UITextField in an iOS application. I am eventually trying to get the text color to change via a converter and a boolean on the viewmodel but for now I can't even get a simple binding to work.

var set = this.CreateBindingSet<MyView,MyViewModel>();
set.Bind(MyField).For(v => v.BackgroundColor).To(v => v.ExplicitUIColor);   // WORKS
set.Bind(MyField).For(v => v.TextColor).To(v => v.ExplicitUIColor);         // FAILS !!!
set.Apply();

MyField is defined as a UITextField and the ExplicitUIColor property is defined as returning a UIColor.

I get the error

MvxBind: Warning: 27.11 Failed to create target binding for binding TextColor for ExplicitUIColor

Any ideas please?

Thanks

Paul

1

1 Answers

1
votes

Turns out it was getting optimized out by the linker.

http://forums.xamarin.com/discussion/36008/uitextfield-textcolor-property-binding-issues-mvvmcross?new=1

Have to include it in the LinkerIncludePlease.cs file.

Hope that helps someone else.

Paul