.NET MAUI Wrap Functionality for WrapLayout control
The WrapLayout is a layout container that lets you position items in rows or columns based on the Orientation
property. When the space is filled, the container automatically wraps items onto a new row or column.
Orientation
The WrapLayout exposes the Orientation
property, which specifies whether the child items will be wrapped in rows (horizontal orientation) or in columns (vertical orientation). By default, the WrapLayout wraps its items horizontally.
The following example demonstrates how to set both the "Horizontal"
and "Vertical"
orientation:
And the resources for RadBorder
and Label
In the example, telerik
is defined like this:
The following image shows the end result on different platforms:
Item Size
The WrapLayout exposes the ItemWidth
and ItemHeight
properties, which define the layout area for each child element. By default, the available size for the items is not restricted.
Here is a quick sample of a WrapLayout with a specified item size:
The following image shows the end result.
Positioning the Last Child Element
The WrapLayout exposes the StretchLastChild
property, which enables you to control the position and layout of the last child item from the layout items collection. If set to True
, the last element will stretch along the remaining space from the last row or column depending on the layout orientation.
The following example shows how StretchLastChild
will work when set to both values:
The following image shows the end result.