My window is a Grid, the 2nd row stretches to fill the window.
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
The content of the 2nd row is a StackPanel. I imitated the solution of a similar question on SO and it doesn’t work for me: height of listbox doesn’t stretch to fill the 2nd row. What’s wrong with my code? Thanks.
<StackPanel x:Name="lbStackPanel" Grid.Row="1" >
<ListBox Name="listBox1" Height="{Binding ElementName=lbStackPanel, Path=ActualHeight}">
...
</ListBox>
</StackPanel>
Why do you need a
StackPanelthere?Just take it out and the row should size correctly.