'How to render a dynamic controls in Xamarin xaml
I would like some help as I am new to Xamarin, I'm trying to create a simple Questionair Application, where every question have a corresponding answers value and control type stored in the database.
Public class Question
{
public Guid Id { get; set; }
public string description { get; set; }
public List<Answer> Answers { get; set; }
}
Public class Answer
{
public Guid Id { get; set; }
public Guid QuestionId { get; set; }
// This could be radio button, dropdown, calendar picker, textbook, slider
public string ControlType { get; set; }
public string answerValue { get; set; }
}
So far I was able to get all the answers for every question, however, I'm stuck on how am I able to render this controls in xaml. Hope you could help me guys.
Thank you
Solution 1:[1]
If you want to display all the questions and answers on one interface, you can create a wrapper class with all the properties of the question and answer. Then use ListView or CollectionView to display all the information.
If you don't want to display on the same interface, you can display all the questions on the main interface by using ListView or CollectionView. When you click on the question, a pop-up interface (Rg.Plugins.Popup is relatively simple) will appear. There is all the answer information.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Wen xu Li - MSFT |
