UIelement - Specify type

Sep 17 2009 1:49 PM
I'm in the situation I need to add a control. This control can be a button, label, a homemade control or whatever.
Point is I don't know which type it is.

I got a input which is a UIelement (called original), which has a type. Afterwards I need to create a control of the type UIelement original has.

For instance:

UIelement ele = new TYPE-OF-original;

Or even better:

UIelement ele = new UIelement;
ele.SetType = TYPE-OF-UIELEMENT;

Problem is I don't think you can set a type to a UIelement.
I can get the type of UIelement by the GetType() method. But how do I add it generic?

UIelement ele = new GetType(original)
.. Dosnt work either

Further on I might need to be able to set width/height of the control, which UIelement dosn't support.

Answers (3)