The button and label are not elongated vertically, but only horizontally (i.e. they do not fill the entire window in both directions). Why?
, . , StackPanel, - :
StackPanel , - , Horizontal , Vertical. , ( ), . , , VerticalAlignment Stretch, .
, , , (t26) ( Grid - , ). , .
Edit
" ": , StackPanel , . , Button, Label .., ? , , , , VerticalAlignment "Stretch", ? . , , x () - , .. ( VerticalAlignment "Stretch" ).
, :
public class TestControl : ContentControl
{
public string Description { get; set; }
protected override Size MeasureOverride(Size availableSize)
{
System.Diagnostics.Debug.WriteLine("Size available for '" + Description + "': " + availableSize.Height);
return base.MeasureOverride(availableSize);
}
}
, , . Grid a StackPanel :
<Grid Height="50">
<Grid.RowDefinition />
<Grid.RowDefinition />
<local:TestControl Description="in Grid" />
<StackPanel Grid.Row="1" Height="10">
<local:TestControl Description="in StackPanel" />
</StackPanel>
</Grid>
, Grid CustomPanel ( ) 25 ( ). StackPanel, , CustomPanel .