user controls - WPF Howto create a reusable composite component with configurable content? -


i create component made of arbitrary control , little button beside control (same in example: http://putridparrot.com/blog/wpf-composite-control/).

my problem content element (the 1 beside button) not have textbox, can kind of control. there way create component provides button, , content element can freely chosen @ design- or run-time?

you can replace textbox stackpanel, , in code behind add children controls want.

ex: in xaml:

<stackpanel name="testpanel" grid.column="0" /> 

in code behing when usercontrol or window loaded or when button pressed..put this:

testpanel.children.add(new combobox()); --- this... 

this way, can assure whatever put in stackpanel (it can grid or dockpanel...) appear before button , can on runtime create control need.

regards,

sm


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -