-api-id | -api-type |
---|---|
P:Windows.UI.Xaml.FrameworkElement.MaxHeight |
winrt property |
Gets or sets the maximum height constraint of a FrameworkElement.
<frameworkElement MaxHeight="double"/>
The maximum height of the object, in pixels. The default value is PositiveInfinity. This value can be any value equal to or greater than 0. PositiveInfinity is also valid.
MaxHeight is one of three writable properties on FrameworkElement that specify height information. The other two are Height and MinHeight. If there is a conflict between these values, the order of application for actual height determination is that first MinHeight must be honored, then MaxHeight, and finally, if it is within bounds, Height. All of these properties are recommendations to the layout behavior of the element's parent in the object tree. The height of the object after layout runs is available as the ActualHeight property value.
The final ActualHeight of an element might exceed MaxHeight. For example, if UseLayoutRounding is set to true and your app is running on a display with a Resolution Scale greater than 100%, then the ActualHeight may be rounded up to help ensure your UI doesn't look blurry when scaled.
This XAML example shows a technique of specifying a MaxHeight for a ViewBox. ViewBox is a decorator that can apply layout information to a single child and divide layout areas for the next parent element (in this case a StackPanel).
[!code-xamlViewBoxXAML]