Q:

Make container fill only by content

I'm facing a layout problem. I need to make a Window with a layout that works for these two situations: 

I tried something with DockPanel, but this way the yellow container were stretching even with no content. I need to do something with the content (a UserControl) that makes it happen.
EDIT: "Image's "CONTENT FIXED WITH" = "CONTENT FIXED HEIGHT"

A:

I guess you could use an IValueConverter for this...
<Grid>
    <Grid.Resources>
        <converters:NullableToVerticalAlignment FalseAlignment="Top" 
                                                TrueAlignment="Stretch" />
    </Grid.Resources>

    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>

    <custom:ContentWithFixedHeight />

    <custom:ContentWithVariableHeight Grid.Row="1"
                                      VerticalAlignment="{Binding Content,
                                                                  RelativeSource={RelativeSource Mode=Self},
                                      Converter={StaticResource NullableToVerticalAlignmentConverter}}" />
</Grid>

And the Converter itself:
public class BooleanToVerticalAlignment : IValueConverter
{
    public VerticalAlignment FalseAlignment { get; set; }

    public VerticalAlignment TrueAlignment { get; set; }

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return (bool)value ? TrueAlignment : FalseAlignment;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

