ItemHeight property

VariableSizedWrapGrid.ItemHeight property

Gets or sets the height of the layout area for each item that is contained in a VariableSizedWrapGrid.


public double ItemHeight { get; set; }

<VariableSizedWrapGrid ItemHeight="double" />
<VariableSizedWrapGrid ItemHeight="Auto" />

Property value

Type: System.Double [.NET] | float64 [C++]

The height of the layout area for each item that is contained in a VariableSizedWrapGrid. The default is Double.NaN, which results in the "Auto" layout behavior.


"Auto" layout and Double.NaN

The default value of ItemHeight and ItemWidth is not 0, it is Double.NaN. ItemHeight and ItemWidth support the ability to be an unset "Auto" value. Because ItemHeight and ItemWidth are Double values, Double.NaN is used as a special value to represent this "Auto" behavior. The layout system interprets the "Auto" value to generally mean that the object should be sized to the available size in layout, instead of to a specific pixel value. If you want the "Auto" behavior for an object when it is used in layout, leave ItemHeight and ItemWidth unset at their Double.NaN default value. If you have previously set values and want to reenable the "Auto" behavior with run-time code, set to Double.NaN. In XAML such as templates, you can set attribute values using the string "Auto".

Note  Visual C++ component extensions (C++/CX) doesn't have a constant for NaN, it uses a value, which appears as "-1.#IND" followed by zeros.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::UI::Xaml::Controls [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]


Windows::UI::Xaml::Controls [C++]



See also




© 2016 Microsoft