c# - MinHeight on resizeable Expander -


i'm trying create style automatically makes expanders resizeable, embedding content inside grid gridsplitter.

<window.resources>     <style targettype="expander">         <setter property="background" value="gold"/>         <setter property="fontsize" value="17"/>         <setter property="contenttemplate">             <setter.value>                 <datatemplate>                     <grid margin="0" background="red">                         <grid.rowdefinitions>                             <rowdefinition height="auto" minheight="{binding ???}"/>                             <rowdefinition height="5"/>                         </grid.rowdefinitions>                         <contentcontrol content="{binding}" minheight="{binding ???}"/>                         <gridsplitter grid.row="1" height="5" background="green"                                 horizontalalignment="stretch"                                resizebehavior="previousandcurrent"/>                     </grid>                 </datatemplate>             </setter.value>         </setter>     </style> </window.resources> <grid>     <grid.rowdefinitions>         <rowdefinition height="auto"/>         <rowdefinition height="auto"/>     </grid.rowdefinitions>     <expander grid.row="0" isexpanded="true" header="expander...">         <border background="blue" minheight="200" borderthickness="5" borderbrush="black"/>     </expander>     <expander grid.row="1" isexpanded="true" header="expander...">         <border background="blue" minheight="100" borderthickness="5" borderbrush="black"/>     </expander> </grid> 

what can't work out how bind minheight of rowdefinition (or contentcontrol) inside style minheight of content of expander.

(note, garish colours see what's what...)

i not sure how dinamycally need , if solves issue:

<grid.rowdefinitions>             <rowdefinition x:name="gridrowdefinition" height="auto" minheight="20"/>             <rowdefinition x:name="gridrowdefinition2"  height="auto" minheight="20"/>         </grid.rowdefinitions> 

and in style

<setter.value>                     <datatemplate>                         <grid margin="0" background="red">                             <grid.rowdefinitions>                             <rowdefinition height="auto" minheight="{binding minheight, elementname=gridrowdefinition}"/>                                 <rowdefinition height="5"/>                             </grid.rowdefinitions>                         <contentcontrol content="{binding}" minheight="{binding minheight, elementname=gridrowdefinition2}"/>                             <gridsplitter grid.row="1" height="5" background="green"                             horizontalalignment="stretch"                            resizebehavior="previousandcurrent"/>                         </grid>                     </datatemplate>                 </setter.value> 

because not see why place content in expander if add border inside expander. hope helps