Let's say there's a WPF window which has a StackPanel
within which there is a control (WebBrowser
, in my case). I want its height to increase when I increase the window's height. I am able to produce the effect in terms of width but no so in height.
xaml (which did not work):
<Window Height="700">
<StackPanel Height="Auto">
<WebBrowser x:Name="browser" Height="Auto" MinHeight="410" />
</StackPanel>
</Window>
Why don't you use Grid
then instead of StackPanel
(OR you can also have StackPanel
within the Grid
if really required), see the code snippet below:
XAML:
<Window Height="700">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<WebBrowser x:Name="browser" Height="Auto" MinHeight="410" />
</Grid>
</Window>