c# - WPF: Multiple content presenters in a custom control? -


i'm trying have custom control requires 2 or more areas of xaml defined child control - inherits control. i'm wondering if there's way define multiple contentpresenters , 1 acts default content presenter

<mycontrol>       <mycontrol.mycontentpresenter2>            <button content="i inside second content presenter!"/>       </mycontrol.mycontentpresenter2>        <button content="i inside default content presenter" /> </mycontrol> 

is possible, how define in custom control's template?

the template can bind separate contentpresenter instances (i've set 1 property here you'll want set others):

<contentpresenter content="{templatebinding content1}"/> <contentpresenter content="{templatebinding content2}"/> 

the control should expose 2 properties content , set default using contentpropertyattribute:

[contentproperty("content1")] public class mycontrol : control {     // dependency properties content1 , content2     // might want content1template, content2template, content1templateselector, content2templateselector } 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -