'How to render list<object> in xaml

I created a set of controls in code behind, but I'm stuck on how to render it in xaml.

    private List<object> _controlList;

    var _radio1 = new RadioButton();
    var _radio2 = new RadioButton();

    var _textbox1 = new TextBox();

    _radio1.Content = "Radio 1";
    _radio1.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(RadioButton));

    _radio2.Content = "Radio 2";
    _radio2.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(RadioButton));

    _textbox1.Text = "Textbox 2";
    _textbox1.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(TextBox));

    _controlList.Add(_radio1);
    _controlList.Add(_radio2);
    _controlList.Add(_textbox1);

Because I can't access the stacklayout in my xaml due to it is nested stacklayout, that's why I can't use something like stacklayout.children.add(). So instead I create a list of object and hoping to just bind it in a collectionview and automatically render it.

Hope you can help me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source