In a UserControl I have:
<Grid>
<DockPanel Grid.Column="0"
LastChildFill="True">
<Label x:Name="ProductName"
HorizontalAlignment="Stretch"
DockPanel.Dock="Top"
Background="Red"
Height="60" />
<Label x:Name="Versie"
HorizontalAlignment="Stretch"
DockPanel.Dock="Top"
Background="Green"
Height="20" />
<Label x:Name="Copyright"
HorizontalAlignment="Stretch"
DockPanel.Dock="Top"
Background="Blue"
Height="20" />
<Label x:Name="Company"
HorizontalAlignment="Stretch"
DockPanel.Dock="Top"
Background="Yellow"
Height="20" />
<Label x:Name="Omschrijving"
HorizontalAlignment="Stretch"
**--> Answer: add this: VerticalAlignment="Stretch"**
Background="Tomato"/>
</DockPanel>
</Grid>
I expected that the last label would fill the available vertical space in the dockpanel/grid, because of LastChildFill="True"
. Its height however is a default 'auto' of 10, it doesn't fill.
The last label does not respond to DockPanel.Dock which I suppose is ok and a result of LastChildFill="True"
.
What can I do to make the heigth fill the remaining height?