Feb 04, 2014, 1:14 AM
[CLOSED] Dynamic composition assistance needed
Hey Guys,
I've been trying to figure out a way to create controls without knowing their type until runtime.
To trim down the idea, let's assume a List<string> which contains strings that represent types of controls. e.g.
So I would need to iterate over the parents, add them to a Container/panel/formpanel etc, then loop through that set of children and essentially build the control tree that way. I am having a hard time finding a good, elegant way to do this. Maybe I'm just over thinking the problem.. I don't know. I've been scratching my head on this for a bit and wouldn't mind some outside input.
Thanks.
I've been trying to figure out a way to create controls without knowing their type until runtime.
To trim down the idea, let's assume a List<string> which contains strings that represent types of controls. e.g.
var listOfItems=new List<string> {"textfield","panel","formpanel","combobox","radiobutton"}
I've been trying to figure out a way to iterate over this list and GENERICALLY create the controls needed. To complicate this a bit further, in my real world data, I would have a list of parents and children that might like like the list above. So basically a multi-dimensional array. So I would need to iterate over the parents, add them to a Container/panel/formpanel etc, then loop through that set of children and essentially build the control tree that way. I am having a hard time finding a good, elegant way to do this. Maybe I'm just over thinking the problem.. I don't know. I've been scratching my head on this for a bit and wouldn't mind some outside input.
Thanks.
Last edited by Daniil; Feb 14, 2014 at 1:44 PM.
Reason: [CLOSED]