WPF UserControl is not filling parent container when bound at runtime -


i have window has stackpanel, , stackpanel has contentcontrol, gets usercontrol bound @ run time.

(in mainwindow.xaml)

<stackpanel margin="6,14,5,6" grid.row="1">   <contentcontrol name="windowcontent" content="{binding}" horizontalcontentalignment="stretch" verticalcontentalignment="stretch" /> </stackpanel> 

(in mainwindow.xaml.cs)

windowcontent.content = new mainwindowview(); 

i want usercontrol (and it's children) fill space in stackpanel.

i have checked of heights , widths set auto, , horizontal/verticalalignments set stretch, , horizontal/verticalcontentalignments set stretch.

is there i'm missing? seems silly question, can't work!

thanks

the stackpanel container sizes content's minimum size. believe want use grid rather stackpanel; grid attempt use available space.

<grid margin="6,14,5,6" grid.row="1">    <contentcontrol name="windowcontent" content="{binding}" horizontalcontentalignment="stretch" verticalcontentalignment="stretch" /> </grid>  

edit: if want same kind of stacking functionality in grid, this:

<grid>     <grid.rowdefinitions>         <rowdefinition height="auto"/>         <rowdefinition height="auto"/>         <rowdefinition height="*"/>     </grid.rowdefinitions> </grid> 

that make 2 minimally sized rows (like stackpanel) , row took rest of available space.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -