I've Got a Window with this basic layout:
<Window
MinHeight="72" MaxHeight="400" Height="Auto"
MinWidth="460" MaxWidth="460">
<DockPanel>
<!-- Footer -->
<StackPanel DockPanel.Dock="Bottom">
...
</StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="Auto" MinHeight="0"/>
<RowDefinition Height="Auto" MinHeight="0" MaxHeight="40" />
</Grid.RowDefinitions>
<StackPanel>
<!-- Header -->
</StackPanel>
<TextBlock Grid.Row="1" Visibility="{My Fancy Binding To collapse this}" ... />
<TextBlock Grid.Row="2" Visibility="{My Fancy Binding To collapse this}" ... />
</Grid>
</DockPanel>
</Window>
What im trying to achieve is a window that's compact when the Two TextBlock's at the bottom are Visibility="Collapsed", and expands up to a max height set when they're not.
This works quite alright for the <Grid>
but it seems that no matter how i re-arrange my layout, i can't get the window to attempt to use the minimum space, it always sits at max-size with a lot of useless whitespace.
What is happening:
+-----------------------------------+ | Header | +-----------------------------------+ +-----------------------------------+ +-----------------------------------+ | | | Wasted Space I want to | | "collapse" | | | +-----------------------------------+ | Footer | +-----------------------------------+
What I want:
+-----------------------------------+ | Header | +-----------------------------------+ +-----------------------------------+ +-----------------------------------+ +-----------------------------------+ | Footer | +-----------------------------------+ Or Effectively: +-----------------------------------+ | Header | +-----------------------------------+ | Footer | +-----------------------------------+