WrapGrid.ItemWidth property

Applies to Windows and Windows Phone

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


public double ItemWidth { get; set; }

<WrapGrid ItemWidth="double" />

Property value

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

The width of the layout area for each item that is contained in a WrapGrid. 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.


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




© 2015 Microsoft