Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to render controls defined in Json structure using MvvmCross?
    primarykey
    data
    text
    <p>I have a situation where my view definition(i.e. the content that gets displayed on a layout file) is defined in a json structure. I need to be able to define this json structure along with bindings and then my code should be able to dynamically create controls based on the json structure and fill out the layout.</p> <p>I am able to accomplish the same using code below.</p> <pre><code> protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); FirstViewModel firstViewModel = new FirstViewModel() { Id = 1001, FirstName = "Amit", MiddleName = string.Empty, LastName = "Taparia", Race = "Asian", IsUSNational = false }; this.ViewModel = firstViewModel as IMvxViewModel; var bindings = this.CreateInlineBindingTarget&lt;FirstViewModel&gt;(); this.Root = new RootElement("Main View", null, null). { new Section("Personal Information") { new StringElement("Employee#","Enter Employee#").Bind(bindings,vm =&gt; vm.Id) new EntryElement("FirstName","Enter First Name").Bind(bindings,vm=&gt;vm.FirstName), new EntryElement("MiddleName","Enter Middle Name").Bind(bindings, vm=&gt; vm.MiddleName), new EntryElement("LastName","Enter Last Name","Amit",null).Bind(bindings, vm =&gt; vm.LastName), new EntryElement("Race","Enter Race").Bind(bindings,vm =&gt; vm.Race), new BooleanElement("US National",true,).Bind(bindings, vm =&gt; vm.IsUSNational). }, }; } </code></pre> <p>But I need to be able to do the same using a structure defined in json file. I know we can do something like this using MvvmCross, but I dont know how to do this.</p> <p>I came across these three sample solutions a) CustomerManagement b) CustomerManager.AutoView Here I do see that we have a BaseCustomerEditView.cs where there is a json structure defined, but the code is commented out. c) DialogExamples</p> <p>Couple of questions</p> <p>1) Whats the difference between using AutoView and MvxDialog? Is it one and the same thing?</p> <p>2) Are there any potential limitations using the control structure defined in json file. I do see one problem related to alignment. We wont have any control over the alignment of controls defined in json file.</p> <p>3) How to achieve rendering/binding using a structure defined in json file?</p> <p>Looking forward to your responses.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload