android - Setting ViewModel for MvxFragment -


i working on application using xamarin.android , mvvmcross , running issues trying set viewmodel (mvxviewmodel) fragment (mvxfragment).

in research far, have found examples seem pretty dated and, therefore, no longer useful.

https://forums.xamarin.com/discussion/3652/mvvmcross-activity-vs-fragment http://slodge.blogspot.com/2013/06/n26-fragments-n1-days-of-mvvmcross.html

my specific situation trying create application drawerlayout have working fine, problem when load mvxfragment subclass via fragmentmanager viewmodel not being associated view (the viewmodel correctly associated before changed view activity fragment.)

when looking documentation on how this, found following code

    public override view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate)     {         var ignored = base.oncreateview(inflater, container, savedinstancestate);         return this.bindinginflate(resource.layout.fragment_detail, null);     } 

the issue there no method bindinginflate(...) in mvxfragment.

here oncreateview looks like

    public override view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate)     {         var ignored = base.oncreateview(inflater, container, savedinstancestate);         var view = inflater.inflate(resource.layout.homeview, container, false);         return view;     } 

so question boils down to: how associate viewmodel view extention of mvxfragment?

not sure if helps, creating fragment so

var fragment = new homeview(); fragmentmanager.begintransaction().replace(resource.id.content_frame, fragment).commit(); 

i can't believe missed this, solution simple. had add this.

using cirrious.mvvmcross.binding.droid.bindingcontext; 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -