ios - MvvmCross: RaisePropertyChanged not updating binding -
i instantiating view viewmodel this:
var myview = new myview { datacontext = new myviewmodel() };
i want make view accessible anywhere in application adding view rootviewcontroller:
window.rootviewcontroller.view.add(myview.view);
where viewmodel inherits mvxviewmodel , myview inherist mvxviewcontroller
inside myview binding uilabel text property this
this.createbinding(mylabel).to<myviewmodel>(vm => vm.mytextprop).apply();
the text property defined inside viewmodel this
private string mytextprop; public string mytextprop { { return mytextprop; } set { mytextprop = value; raisepropertychanged(() => mytextprop); } }
the binding works when loaded. when change mytextprop property , raisepropertychanged called uilabel not being updated.
i binding icommand works fine , triggers normally.
instead of doing var myview = new myview { datacontext = new myviewmodel() };
let mvvmcross construct mvxviewcontroller doing this:
var viewcontroller = this.createviewcontrollerfor<myviewmodel>();
createviewcontroller
extensions method imvxcancreatetouchview
, class view construction should implementing inteface, otherwise method not available.
i know imvxcancreatetouchview
implemented mvxtouchviewpresenter
, mvxviewcontroller
can call method presenter
or mxvviewcontroller
.
Comments
Post a Comment