WPF: How to make HeaderedContentControl.Content fit height?
Problem here is HeaderedContentControl
uses StackPanel
internally to layout header and content.
To fix that, use a Grid
instead or re-template HeaderedContentControl
to use Grid
.
Example:
<ControlTemplate TargetType="HeaderedContentControl">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ContentControl Content="{TemplateBinding Header}" Grid.Row="0" />
<ContentControl Content="{TemplateBinding Content}" Grid.Row="1" />
</Grid>
</ControlTemplate>