Skip to content

Latest commit

 

History

History
40 lines (24 loc) · 2.43 KB

frameworkelement_maxwidth.md

File metadata and controls

40 lines (24 loc) · 2.43 KB
-api-id -api-type
P:Windows.UI.Xaml.FrameworkElement.MaxWidth
winrt property

Windows.UI.Xaml.FrameworkElement.MaxWidth

-description

Gets or sets the maximum width constraint of a FrameworkElement.

-xaml-syntax

<frameworkElement MaxWidth="double"/>
 

-property-value

The maximum width of the object, in pixels. The default is PositiveInfinity. This value can be any value equal to or greater than 0. PositiveInfinity is also valid.

-remarks

MaxWidth is one of three writable properties on FrameworkElement that specify width information. The other two are MinWidth and Width. If there is a conflict between these values, the order of application for actual width determination is that first MinWidth must be honored, then MaxWidth, and finally, if it is within bounds, Width. All of these properties are recommendations to the layout behavior of the element's parent in the object tree. The width of the object after layout runs is available as the ActualWidth property value.

The final ActualWidth of an element might exceed MaxWidth. 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 ActualWidth may be rounded up to help ensure your UI doesn't look blurry when scaled.

-examples

This XAML example shows a technique of specifying a MaxWidth 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]

-see-also

Width, MinWidth, Define layouts with XAML