wpf - Custom control acting as Page allowing children in XAML -


i have 2 questions:

  1. how modify custom control inherits frameworkelement holds 1 child (e.g. page or contentcontrol) holds multiple children (like panel)? can done class definition?

  2. how bind children of custom control panel object (e.g wrappanel) defined in template of custom control?

i'm not sure if possible, want create custom control behaves page, or may inherit page, allows me enter in children in xaml. example, xaml generating custom control this:

<custompage customattribute="blah">     <textbox/>     <textblock text="hehe"/>     <label content="ha!"/> </custompage> 

i want define in style wrappanel displays children. this:

<style targettype="{x:type custompage}">     <style.setters>         <setter property="template">             <setter.value>                 <controltemplate targettype="{x:type custompage}">                     <wrappanel/>                 </controltemplate>             </setter.value>         </setter>     </style.setters> </style> 

i replace wrappanel contentpresenter except want contentpresenter behave wrappanel.

i hope specific enough.

you can want itemscontrol.

    <itemscontrol>         <itemscontrol.itemspanel>             <itemspaneltemplate>                 <wrappanel/>             </itemspaneltemplate>         </itemscontrol.itemspanel>         <itemscontrol.items>             <textbox/>             <textblock text="hehe"/>             <label content="ha!"/>         </itemscontrol.items>     </itemscontrol> 

hope helps

edit: can use above itemscontrol root element in page gain page's functionality.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -