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
Post a Comment