Results 1 to 2 of 2

Thread: Generate dynamic control in xaml

  1. #1

    Thread Starter
    Lively Member FunkySloth's Avatar
    Join Date
    Aug 2016
    Posts
    91

    Generate dynamic control in xaml

    Hi Guys,

    Does anyone have sample on how to generate a dynamic control base on return type from database. I was able to get the data, however i have no idea how to generate the dynamic controls in xaml, this is a survey type application.

    I got this kind of Models:

    Code:
    Public class Question
    {
         public int Id { get; set; }
         public string description { get; set; }
         public List<Answer> Answers { get; set; }
    }
    
    public class Answer
    {
        public int Id { get; set; }
        public int questionId { get; set; }
        public string description { get; set; }
        public string controlType { get; set; }
    }
    The output could be:

    Question Description
    - RadioButton
    - RadioButton

    Question Description
    - Textbox

    Question Description
    - Dropdown

    I am new on how the structure of xamarin works.

    Thank you
    Last edited by FunkySloth; Mar 22nd, 2022 at 07:51 AM.

  2. #2
    Lively Member
    Join Date
    Apr 2022
    Posts
    65

    Re: Generate dynamic control in xaml

    Uh...no but it needs to be protected to be thread safe.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width