Click here to Skip to main content
14,357,409 members
Rate this:
Please Sign up or sign in to vote.
I want to create a custom control by which the control can draw controls in it by a dependency property value.
To make it clear, we have a custom control like in the following:
<mycustomcontrol mypropery="TextBox"></mycustomcontrol>

My expectation is to draw a control(here is textbox) inside MyCustomControl according to the value of "myproperty".
Is something like this is posibble guys?
Thanks!
Posted
Updated 18-Sep-15 22:01pm
v2
Comments
   
Of course it is possible. What have you tried so far?
Only "to draw" sounds incorrect. You either insert UI elements into a logical tree, or do direct graohics rendering, but it has nothing to do with "its controls".
—SA
Sinisa Hajnal 21-Sep-15 2:30am
   
It is possible, but you shouldn't do it. In your particular case you should add textbox to your custom control controls collection, not draw it from nothing.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100