xamarin.ios - How do I do two-way binding to a UITextView control using mvvmcross? -


i have simple view created using xcode (it's xib). consists of 2 uitextview controls , uibutton. i've exposed uitextview controls outlets , given them names. looks in view.designer.cs file.

i'm creating binding using syntax:

        this.addbindings(             new dictionary<object, string>()             {                 {lastname, "{'text':{'path':'lastname','mode':'twoway'}}"},                 {uservin, "{'text':{'path':'carvin','mode':'twoway'}}"}              }); 

when move lastname uitextview uservin uitextview expect setter in viewmodel called, doesn't. when click button , check value of 2 text properties on viewmodel, both null.

does know i've done wrong? i've got quick demo due on tuesday , have other platforms working beautifully, can't seem past issue.

cheers,

/j

i think problem using uitextview instances... mvvmcross vnext ships 2-way binding uitextfield elements.

to add uitextview 2-way binding older mvvmcross version:

  1. add custom target binding class - bit 1 v3: https://github.com/slodge/mvvmcross/blob/v3/cirrious/cirrious.mvvmcross.binding.touch/target/mvxuitextviewtexttargetbinding.cs

  2. register during setup.cs code like:

    protected override void filltargetfactories(imvxtargetbindingfactoryregistry registry) {     base.filltargetfactories(registry);      registry.registerfactory(new mvxsimplepropertyinfotargetbindingfactory(typeof(mvxuitextviewtexttargetbinding), typeof(uitextview), "text"); } 

alternatively (but maybe not before immediate demos), consider updating v3 beta release.


incidentally, using 'swiss' binding syntax normal way this:

    this.addbindings(         new dictionary<object, string>()         {             {lastname, "text lastname"},             {uservin, "text carvin"}         }); 

... , twoway binding default non-windows mvvmcross bindings.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -