c# - How to stretch and extend a grid up to a parent margin -


i have simple structure (semplification of more complicated one) made this:

enter image description here

so xaml is:

<grid > <grid.columndefinitions>   <columndefinition width="auto" />   <columndefinition width="*" /> </grid.columndefinitions> <border x:name="border1tab3" borderbrush="gainsboro" borderthickness="5" width="200" margin="10,10,10,10" > </border> <border x:name="border2tab3" borderbrush="gainsboro" background="{x:null}"  minwidth="100" borderthickness="5" grid.column="1" margin="10,10,10,10"  >   <stackpanel name="sptab3" margin="0" background="red" verticalalignment="stretch" horizontalalignment="stretch">  <------red      <grid name="grd7tab3" visibility="visible" background="blue"  showgridlines="true"  verticalalignment="stretch"  margin="10">  <----blue     </grid>    </stackpanel> </border> 

so can see have put red colour in stack panel , blue in grid. extend blue grid red stack panel effect grid doesn't show up.

enter image description here

and if put in red stack panel gets size of inside element instead getting parent size.

enter image description here

i newbie @ wpf speaking if set margin=0 , stretch schouldn't ui element take spake of parent?

thank patrick

simply change stackpanel grid, seems more appropriate case

 <border x:name="border2tab3" borderbrush="gainsboro" background="{x:null}"  minwidth="100" borderthickness="5" grid.column="1" margin="10,10,10,10"  >         <grid name="sptab3" margin="0" background="red" verticalalignment="stretch" horizontalalignment="stretch">             <grid name="grd7tab3" visibility="visible" background="blue"  showgridlines="true"  verticalalignment="stretch"  margin="10">              </grid>         </grid>     </border> 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -