Dynamic Form With three Templates to Input Data

ebaeebae ✭✭Member ✭✭

Hello, my goal is to have a scrollable view with three "sections". Each "section" is a view with a button at the bottom when the user clicks that button, then the appropriate entries will be added to that section. I want the user to be able to click and add as many entries to the section while being able to enter retrieve the data from the individual entry. I am unsure what the best practice for this would be. I have been messing around with Listview, but feel like grid or tableview might be better suited for this task.

Posts

  • JohnHardmanJohnHardman mod GBUniversity mod
    edited July 2018

    @ebae - I do something very similar, populating just the initial, common, section of a form, then constructing the rest of the form in sections as the user makes selections or as the user hits "Show more" type buttons. I find a StackLayout with vertical orientation works absolutely fine for this. Performance is fine, as any one operation only results in the addition of a limited number of additional Views. I might experiment in future with preparing on a background thread the info required if the user were to hit the next "Show more" type button, but that's one for optimisation time later on.

    The more interesting bit is wiring up Completed handlers and TabIndex properties so that keyboard operation works as expected even with a dynamically constructed form (I am using XF 2.4, so added my own TabIndex handling).

  • ebaeebae ✭✭ Member ✭✭

    Let's say I have three buttons initialized when the user clicks button1, section1 needs to show three entry boxes for adding a new model, for example, we will say a dog. When the user clicks button2, section2 needs to show five entries with two switches to add a new model of a cat. And then the third will be similar. How do I implement that? I am an intern at my company and am tasked with learning xamarin and finding the possibilities and limitations of xamarin. My goal for this program was to see how many I could add dynamically before experiencing errors. Also if you know better terms and tags I could use to get better help on these forums, that would be extremely helpful! Thank you!

    @JohnHardman said:
    @ebae - I do something very similar, populating just the initial, common, section of a form, then constructing the rest of the form in sections as the user makes selections or as the user hits "Show more" type buttons. I find a StackLayout with vertical orientation works absolutely fine for this.

    The more interesting bit is wiring up Completed handlers and TabIndex properties so that keyboard operation works as expected even with a dynamically constructed form (I am using XF 2.4, so added my own TabIndex handling).

  • JohnHardmanJohnHardman mod GBUniversity mod

    @ebae said:
    My goal for this program was to see how many I could add dynamically before experiencing errors.

    If you add too many in one go then it will be slow to do (to add & render). However, that's a one-off in this scenario.
    In terms of total numbers, there used to be some issues on Windows Phone, but support for Windows Phone is now deprecated. I don't recall hitting issues relating to total numbers of Views on other platforms.

    @ebae said:
    Also if you know better terms and tags I could use to get better help on these forums, that would be extremely helpful!

    You're using the correct terms in your original post. In terms of getting better help, be aware that other than a small number of Xamarin staff who seem to have appeared very recently, all others on the forum are volunteers. Volunteers answer questions in whatever spare time they have, so you may or may not get a particular question answered. Normally, the more that you show you have already put effort into research, the more likely it is that you will get helpful answers. On the particular subject of dynamically creating forms, I don't recall seeing any samples of this. I suspect that not many people have done it, so you probably won't get many responses to questions on this particular subject.

    @ebae said:
    How do I implement that?

    Incrementally :-)

Sign In or Register to comment.