I’m seeking a behaviour which combines that of VerticalAlign="Stretch" and VerticalAlign="Top". Please observe the following markup:
<Border BorderThickness="2" BorderBrush="Black" MaxHeight="200">
...
</Border>
This acts as I intend it to until the container of Border becomes greater than 200 tall. At this point, Border becomes 200 tall and centers itself in its container.
I cannot wrap it in DockPanel with DockPanel.Dock=”Top”. I also cannot set its container to VerticalAlign=”Top”. The reason is that both of these cause Border to no longer expand vertically to fill the containers available space (up to 200).
So, in order to consider this problem solved, the following must occur:
- Border must expand to fill its parent’s available space up until its MaxHeight is reached.
- Border’s top edge must meet its parent’s top edge.
- Border does not need to be a
<Border>.
voila: