mvvm - Dynamic Binding UIWebView in MVVMCross -


i'm trying make change sample project cirrious.conference. in particular in touch view @ sessionview class , @ class

https://github.com/slodge/mvvmcross-tutorials/blob/master/sample%20-%20cirriousconference/cirrious.conference.core/viewmodels/sessionlists/basesessionlistviewmodel.cs

on method

protected void navigatetosession(session session) {  showviewmodel<sessionviewmodel>(new { key = session.key }); } 

i'd openl uiwebview (in app) binding loadrequest property of class session (suppose have property url...). have created uiwebview object in sessionview it's not possible create swisse binding...maybe it's possible custombinding...

how i'll it?

since uiwebview doesn't expose property loadrequest, can't bind directly it.

if want use binding loadrequest, 3 options available are:

  1. inherit mywebview uiwebview, add c# property drives loadrequest , use class in ui , property in swiss binding - e.g.:

        [register("mywebview")]     public class mywebview : uiwebview     {         public mywebview()         {         }          public mywebview(intptr handle) : base(handle)         {         }          private string _myurl;         public string myurl         {             { return _myurl; }             set             {                if (_myurl == value) return;                _myurl = value;                loadrequest(value); // or similar (i've not checked syntax!)             }         }     } 
  2. implement custom target swiss binding , add setup.cs. process described in custom bindings presentation - includes links examples (one of them in conference app)

  3. if property never change, don't use binding , instead call loadrequest in mvxviewcontroller viewdidload - e.g.

         public void viewdidload()      {          base.viewdidload();           var myviewmodel = (myviewmodel)viewmodel;          var url = myviewmodel.url;          thewebview.loadrequest(url);      } 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -